Re: Grid event code content disappears after recordsource changed

Tech-Archive recommends: Speed Up your PC by fixing your registry



Ok man.

Let me get this straight.

Your code inside the grid vanishes when you change the recordsource?

I have both LIST BOXES and GRIDS that I do tha same with and never have a
problem.

I use VFP 8 SP1 and all hotfixes..

I think you should change where you are putting your RECORDSOURCE change
from the Init to the Activate and this should fix your problem.

What I believe is happening to you is that the Class for the grid is
re-creating a new grid because of the change in RECORDSOURCE being in the
Init. The Init occurs at the form creation time while the Activate occurs
after all the Properties of the Form are created. In other words you are
creating a change to a Form that is the process of being created instead of
one that is already created.

I could be wrong and it just be a behavior you personally are experiencing
but I am pritty sure, that is what is happening.

Good luck,

Johnny.

"kcs" <kcsemail2001@xxxxxxxxx> wrote in message
news:d63d9c64-7281-44e7-832a-912bb658a1a9@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I have a form with a grid, which contains code for specific events
called while the grid is being used. When the form is started, I
change the grid's recordsource in the form's init event to a table
established within this init event. When I change the recordsource for
this grid to this new table, all the code for events I previously
placed in the grid is no longer accessible. How can I fix this? Is
there a way to replace the event code after the new recordsource is
established? I am so used to using the project designer, I am not sure
how to do this.

Thanks.


.



Relevant Pages

  • Re: Grid und RecordSource Zuweisung
    ... Dem GRID wird zuvor die RecordSource ... entzogen und nach der Erstellung der Tabelle wieder zugewiesen. ... When you want to preserve the previous settings, for example, in scenarios when the new record source has the same structure as the previous one, you can use the SPACEfunction set the RecordSource property temporarily to SPACE. ...
    (microsoft.public.de.fox)
  • Re: Trapping Mouse Click on a grid
    ... The Grid.Init occurs after all the columns has taken ... If placed in the grid's Init event code, ... If the Grid later would be moved somewhere else or saved to a class, ... look into and I will have to do some more reading on this. ...
    (microsoft.public.fox.programmer.exchange)
  • Re: Trapping Mouse Click on a grid
    ... Each grid column has a ControlSource property ... which contains the name of the field in the recordsource that populates the ... Each control, normally a textbox, also has a ControlSource property, ... the active row. ...
    (microsoft.public.fox.programmer.exchange)
  • Re: Grid event code content disappears after recordsource changed
    ... called while the grid is being used. ... change the grid's recordsource in the form's init event to a table ... established within this init event. ... there a way to replace the event code after the new recordsource is ...
    (microsoft.public.fox.vfp.forms)
  • Re: Datenquelle wechseln
    ... RecordSource des Grid auf die neue Datei einstellen ... Damit ist das Grid nie ohne RecordSource. ...
    (microsoft.public.de.fox)