Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Returning the second value of a combo box?

Status
Not open for further replies.

Keepontrying

Programmer
May 12, 2003
67
US
How can I return the second value of the combobox?
I selected 2 fields from the table for my combobox, when I click on the item from the dropdown it will show only the first field not both. Is it possible to display both? if not can I somehow save the second column.

Thanks
John
 
Keepontrying,

Set Combo.ColumnCount properties to 2, to display both columns.

To get the second value:
** in Combo Valid event
cValue = This.List(This.ListIndex, 2)

Hope it helps

-- AirCon --
 
Hi
Make sure in the combobox properties..

RowSource = myalias.myField1, myalias.myField2
RowSourceType = 6
ColumnWidths = 240,240 && suitable for your field size

You can make the work easier, if you right click over the combo and choose the builder wizrd to guide you thru. :)

____________________________________________
ramani - (Subramanian.G) :)
When you ask VFP questions, please add VFP version.
 
John,

Be aware that, no matter what properties you set, you will always see only the first column when the box is in its closed state. Multiple columns are only visible in the dropped down portion.

Mike


Mike Lewis
Edinburgh, Scotland
 
Keepontrying

As I re-read your original post, are you still trying to determine "How can I return the second value of the combobox?"?
If so the above suggestions show you how to make the second column visible in a drop-down combo, but does not explain how to return the value of the second column.
Following the examples above, you would need to also set the BoundTo property to .T. and the BoundColumn to 2. This will return the value of column number 2.



Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top