Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Combo Box Problem
Message
 
 
À
20/10/1999 18:41:29
Jimmy Ditta
Twin City Electronics
Monroe, Louisiane, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00279102
Message ID:
00279170
Vues:
10
>>Also, if these values are in a lookup table, you can use a SELECT command to populate your combo's array. So in the combo INIT:
>>
>>Select field1,field2,field3 from mylookuptable where some_criteria-if_needed order by whatever into array This.aList

In the INIT Method of the ComboBox, put the following code:
This.AddProperty('aList[1]')

* If you have a lookup table, use the following code:

Select field1,field2,field3 from mylookuptable ;
   where some_criteria-if_needed ;
   order by whatever ;
   into array This.aList

with This
    .RowSourceType = 5
    .RowSource = .aList
    .ColumnCount = 3
    .ColumnWidths = "50,0,0"
endwith

* Otherwise, populate the array manually with the following code:

Dimension This.aList[3,3]
with This
    .aList[1,1] = "A"
    .aList[1,2] = 192
    .aList[1,3] = .667
    .aList[2,1] = "B"
    .aList[2,2] = 120
    .aList[2,3] = .882
    .RowSourceType = 5
    .RowSource = .aList
    .ColumnCount = 3
    .ColumnWidths = "50,0,0"
endwith
Now when someone selects a value from the list, you can have code in the InteractiveChange method of the combo:

lnCol2Value = This.aList(ListItemID, 2)
lnCol3Value = This.aList(ListItemID, 3)

If they selected "B" from the example list above, lnCol2Value is now equal to 120, and lnCol3Value is equal to 0.882.

You can also access these values from any other control or form method, just by referencing the combo:

lnCol2Value = ThisForm.Name_of_ComboBox.aList(ListItemID, 2)
lnCol3Value = ThisForm.Name_of_ComboBox.aList(ListItemID, 3)
Mark McCasland
Midlothian, TX USA
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform