Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Combo Box Problem
Message
 
 
To
20/10/1999 17:38:06
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00279102
Message ID:
00279147
Views:
11
>>>if you have a combo box with 3 columns and only the 1st column is visible to the user, how do you reference the other two columns?
>>>
>>>for example, if the combo box is filled as follows:
>>>row1: "1"(visible), "192", ".667"
>>>row2: "2"(visible), "120", ".882"
>>>
>>>and i want to use the value in the third column in a mathematical function based on what the user selects in the visible column:
>>>
>>>variable = 10 * thirdcolumnvalue
>>>
>>>what should i replace thirdcolumnvalue with to get the proper result?
>>>
>>>thanks
>>>JD
>>
>>You have to set the ColumnCount and ColumnWidths properties. If you have 3 columns, set the ColumnCount to 3. If you do not want Column 3 to display to the user, the ColumnWidth for that column would be zero. For example, set your ColumnWidths to 30,60,0 for a column width of 30 for col 1, 60 for col 2 and 0 for col 3. If you want the value to be numeric, set the initial value of the Combo to 0 and remove the quotes from the numbers in your 3rd column. Your BoundColumn would be 3 and BoundTo would be True.
>
>
>
>i've got it that far, but i'm wanting to use the value in the second column in some math functions, and the value in the third column in other math functions.
>my widths are 50,0,0. basically, i need to know how to reference the column i want.

If the source is an array, this is very easy. If not, this is really difficult to do. I am not even sure how to do it if the source is not an array.

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

In the INIT of the Combo, you could do the following:
This.AddProperty('aList[1]')
Dimension This.aList[3,3]
with This
   .aList[1,1] = "A"
   .aList[1,2] = 192
   .aList[1,3] = .667
   .aList[2,1] = "A"
   .aList[2,2] = 120
   .aList[2,3] = .882
   .RowSourceType = 5
   .RowSource = .aList
   .ColumnCount = 3
   .ColumnWidths = "50,0,0"
endwith
Mark McCasland
Midlothian, TX USA
Previous
Reply
Map
View

Click here to load this message in the networking platform