Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to locate the item in a Combobox
Message
 
À
06/01/2004 23:10:20
Yim Ming Sun Derek
Spacious Design Consultant
Hong Kong, Hong Kong
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00864495
Message ID:
00864522
Vues:
15
>Hi, I am new to Visual Foxpro,
>I have a form with a combo box control which contain the
>client code, I want to locate the client code and find out the position
>in the combo box control. Use what function and how to code it.
>
>Please advise.
>
>Regards
>Derek Yim

Create a scratch form (modi form oform) and add a visual combo control (MyCombo). THen, run the form and enter the following code in the command window.
Assure your combo style is dropdownlist (2).

Lets add some items to combo:
oform.MyCombo.AddItem("ONE")
oform.MyCombo.AddItem("TWO")

If you click the down arrow on the combo, the list will show ONE and TWO.
Attempt to set the combos value with a string
oform.MyCombo.Value="TWO"
TWO would show in the combo's display field, and:
?oform.MyCombo.ListIndex
would return 2 (the second item in combo)

The listindex for oform.MyCombo.Value="THREE", would be 0, because "THREE" is not in the list.

You could also loop through each listindex item. There are samples in HELP. If you use the value assignment method, be sure to PAD for the actual lenght of the "lookup" field.
Imagination is more important than knowledge
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform