Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Changing the recordsource of a grid
Message
De
25/06/1998 01:53:37
 
 
À
24/06/1998 22:00:23
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00111106
Message ID:
00111458
Vues:
16
>>>>>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
>

>
>Hi all, ^_^;
>
>Edward, sorry for Recoding.
>Just Repost my previous message on this kind of problem.
>[at Self-define Browse Form]
>
>

>Thm.: Try to Reset Grid Column to none!! (i.e. Sure Release Column Object)
>
>With Thisform.Grid1
> RecordSourceType = 0
> RecordSource = ""
> ColumnCount = -1 && Ensure all column object in Grid has Release!!
> RecordSourceType = 1 && Alias
> RecordSource = MyTable
> * At this moment, Grid will capture table structure and
> * Auto adjust ColumnCount to Number of Fields!
>EndWith

OK, will give that a whirl, sounds promising, thank you.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform