Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Combo List and Logicals?
Message
De
21/08/2002 09:17:22
 
 
À
20/08/2002 12:01:22
Wally Noll
Double Aa Builders
Mesa, Arizona, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00691371
Message ID:
00691890
Vues:
14
Hello Wally.

I've concluded that character only is to go in either comboboxes or lists. I think it is made for character only regardless of what documentation says.

Not exactly <s>. This is what I had to say on the subject in 1001 Things You Wanted to Know About VFP:

How do I bind my combo and list boxes?

Obviously, you bind your combo and list boxes by setting the ControlSource property to the name of a field in a table, cursor, or view or to a form property. One gotcha! to be aware of is that you can only bind these controls to character, numeric, or null data sources. If you try to bind a combo or list box to a Date or DateTime field, Visual FoxPro will complain and display the following error at run time:

Error with < ComboName >-Value: Data Type Mismatch.
Unbinding object < ComboName >

If you must bind a combo or list box to a Date or DateTime field, you will have to resort to a little trickery. In this case you cannot use RowSourceTypes of 2-Alias or 6-Fields. You can, for example, set the RowSourceType to 3-SQL Statement and use a SQL statement similar to this as the RowSource:

SELECT DTOC( DateField ) AS DisplayDate, yada, nada, blah FROM MyTable ;
ORDER BY MyTable.DateField INTO CURSOR MyCursor

Leave the ControlSource blank and add this code to its Valid method to update the date field in the underlying table:

REPLACE DateField WITH CTOD( This.Value ) IN MyTable

You will also need to write some code to manually update the control's Value from its ControlSource to mimic the behavior of a bound control when you Refresh it. This code in the combo or list box's Refresh method does the trick:

This.Value = DTOC( MyTable.DateField )
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform