Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grid: ControlSource - column vs CurrentControl?
Message
De
13/12/2006 13:19:27
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
13/12/2006 11:48:17
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01177136
Message ID:
01177302
Vues:
10
>>>>The question is - why do we need to go this troublesome route if RowSourceType = 6 will give us the result we want? And I'm not certain in the answer to this question <g>
>>>
>>>Thanks Naomi! I feel better that at least I'm asking good questions :)
>>>
>>>Maybe someone else can shed some light?
>>
>>I hope someone can join this thread to answer OUR questions <g>
>
>Not sure if this simplifies things for you, but I did see that setting RowSourceType=3 allows you to specify RowSource = your SQL statement. That would save you putting the SQL in your form's Init. Then again, it might be more efficient to only run the SQL one time (in Init).

If you expect the rowsource to change (i.e. you've added records, edited or whatever), the SQL would have to be run again anyway. If you use a SQL statement as a rowsource, the .Requery() method of the combo will run it automatically. If it's a cursor, you'd have to run it yourself before issuing a requery. The requery for a combo (or a listbox) simply means that it re-reads its rowsource and copies from it into its internal array, which you can access using .list and .listitem properties.

You can get the data into your combo's rowsource in yet another way: from an array, which you can build in many ways. Select ... into array, any of a***() functions which build arrays etc. The array can be a property of the combo itself, so it can be quite self-contained. Or you can have a combo without a rowsource, and have some code which will populate it - which is good when you need to add values like "none", "n/a", "all" and other such wildcards that you may need but don't want to have them in your lookup table.

Which is a bit complicated, but then gives you at least one solution for (almost) any scenario. Some features of the combo aren't available for all rowsource types. Some aren't sortable, some won't support incremental search, some won't allow movers in a listbox, some may not support backslash prefix to disable a line - you can always find one that will work for you.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform