Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Helping grid columns survive a new RecordSource?
Message
 
 
À
03/08/2009 22:54:31
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Divers
Thread ID:
01416013
Message ID:
01416017
Vues:
54
>I have a grid where I have set the ControlSource of each column to a field that exists in a custom SQL query, then I run over and over in the form.
>
>So, you know the routine...
>
>oGrid.RecordSource=''
>Select blah,blah,blah from somealias where sometest Into Cursor csrResults
>oGrid.RecordSource='csrResults'
>
>Now the query returns many columns, but I only display certain ones the grid.
>
>So, what is the trick to make the ControlSource setting for each column survive (persist) when the RecordSource of the grid is changed like this. I'm sure I could just write some code that will reinstate it on each column...
>
>oGrid.Column1.RecordSource = 'csrResults.Qty'
>oGrid.Column2.RecordSource = 'csrResults.Length'
>etc.
>
>
>Does it have to be that ugly of a hands-on approach?

There is an alternative solution.

See this class
http://social.msdn.microsoft.com/Forums/en-US/visualfoxprogeneral/thread/3671ab73-de92-4d91-8178-708a6354b196/

It has SaveGridProperties and RestoreGridProperties methods. But I prefer Safe select approach by its simplicity even if it requires temp cursor (2 steps approach).
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform