Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ComboBoxes and Arrays
Message
De
08/06/1999 14:16:12
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00227332
Message ID:
00227574
Vues:
22
>When you have a combobox with a rowsource using an array, how can you set another variable with the value from the same row number of the array but a different column number after you select an item from the array? Example:
>ARRAY =
>1,A
>2,B
>3,C
>4,D
>5,E
>
>The Combobox selects "D" and after that I want another variable to equal "4". How can you reference the array when it is being selected?
>
>Colombo.

My first thought is that I wouldn't use an array to populate the combo box. Using arrays for this duplicates engine behavior, a practice I try to avoid. How I would handle this situation would be;

1) A control table to hold look up values for my controls.
row_id (integer identifier for the row)
group_nm (In this case, this holds the name of the control (mycombo))
prop_nm (In this case, holds the text value to add to the combo)
nvalue (In this case holds the numeric index value for the combo)

row_id group_nm prop_nm nvalue
1 mycombo A 1
2 mycombo B 2
3 mycombo C 3
4 mycombo D 4
5 mycombo E 5

The fact that the row_id and the nvalue are the same is purely coincidence.

2) My combo box (mycombo) will have the following properties.
.rowsourcetype = 3 (SQL Statement)
.rowsource = (See SQL Statement Below)
.boundcolumn = 1 (Column containing the nvalue)

3) SQL Statement

SELECT nvalue, prop_nm FROM ocontrol WHERE group_nm =
INTO CURSOR curtmp01

Your combo box is now populated with the elements from the control table. If you need to add rows to the combo all you have to do is add rows to the combo. By setting the boundcolumn property in the combo, the value of the combobox will be set. No additional code required.

Regards,

Jason
Jason Tryon
Senior Systems Analyst / Technical Lead
eBusiness / iPage
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform