Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
COMBO BOX
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00403861
Message ID:
00403928
Views:
14
>HI,
>
>I have a combo box with 5 columns, the bound column is 2nd and I'd like to display the second column but by default it displays always the first.
>
>How may I display the 2nd column of the selected item?
>
>Thank you
>
>Luc

There is a little trick to do this.
If you want your columns to be in certain order in your combo when it is dropped down, say

mytable.ItemId,ItemDescr,Amount,Price,Producer

and the Bound column is 2, it will have correctly ItemId as DisplayValue and ItemDescr as Value. But you want the second column (ItemDescr) to be a DisplayValue. Then you set your combo to have 6 column in RowSource


mytable.ItemDescr,ItemId,ItemDescr,Amount,Price,Producer

and you set the ColumnWidth property so that 1 st column is invisible:

0,50,60,50,60,70,60

Now you can set BoundColumn to 1 or 3 (does not matter because it points to the same data field)

So, when the combo is open you still see 5 columns in your desired order, but the DisplayValue now comes from first invisible column which is the same as second visible column.

That's it.
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Previous
Reply
Map
View

Click here to load this message in the networking platform