Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changing the recordsource of a grid
Message
From
24/06/1998 09:15:13
 
 
To
24/06/1998 02:23:01
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00111106
Message ID:
00111199
Views:
20
>>>How can I change the recordsource of a grid to another table with a the same structure.
>>>Assume tableA is the current recordsource
>>>If I go...
>>>grid.recordsource= tableB
>>>grid.refresh
>>>
>>>Some of the columns show data from the new table and most contain current record data from tableA for every record of tableB.
>>>This is despite the fact that the controlsource for each column does not contain the table alias.
>>
>>David, when you change Grid.RecordSource all Column.ControlSourse are gone. You are supposed to reset them in your code.
>>
>>Nick
>
>OK, I reset them in code, but no change in result unfortunately. Do I need to reset something else as well, such as columncount?

Basically, when all grid setting code finished your program should say Grid.Refresh. I would recommend you to collect all grid setting code to separate custom method, e.g. 'ResetGrid', it may include:
With Thisform.Grid1
.Recordsource=""
.Recorsdsource="tablex"
.Column1.Controlsource="tablex.field1"
....
.Columnx.Controlsource="tablex.fieldx"
.Column1.ColumnOrder=....
....
.Columnx.Width=...
.Refresh
EndWith
Edward Pikman
Independent Consultant
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform