Link to home
Start Free TrialLog in
Avatar of Pleinpopossum
Pleinpopossum

asked on

multi column ComboBox

Is there an easy way to create a multi columns datacombobox or to link the item selected with an other field

eg:

these values are in a table

id   label
-----------
1  |  man
2  |  Woman
3  |  Martian

the value 1,2,3 are listed in the dropdown combo, when I select 2, woman is printed in a textbox; I'd like to do this without having so create a query (it would be too easy :-))

thanks...
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

The easiest way is to concatenate the 2 fields in your Select query (Select Id + ' - ' + Label AS FieldToDisplay From Table1) and bind the new field to the DataCombo.
Avatar of Pleinpopossum
Pleinpopossum

ASKER

Thank you very much emoreau. The idea is not so bad but the label is just to make the user to ensure he chose the right code. I already thought to this solution. So... I can't use it this way because I would need to isolate the code from the label for other ops... So I'd prefer a solution which would modify the value in the textbox when I change the value in the combo.

Xav.
Standard functionality of the Sheridan grid / combobox (www.shersoft.com)
(Datawidgets)

You have 3 ways of adding data there.
Bound, Unbound or ADDITEM
In the additem, you can add whatever you want, multicolumn, ... It's reacting afterwards just like it came from a query.

Check the properties BoundText, BoundColumn and ListField ....
Bound both the combo and the Text box with same recordset.
ASKER CERTIFIED SOLUTION
Avatar of ndb
ndb

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If you have 2 combo boxes, I visible and 1 invisible, the second containing label, then when you select item 1 from combo1 set the textbox = the corresponding item in the list from combo2
Try to use combo box to keep the id and array to keep the labels.  Whenever you click a item on combo box,

txtLabel = aryLabel(cboID.listindex)

Then the label value can be printed on the text box.
The idea is good but I'm looking for a "natural" solution. In fact the main problem is that the combo has to be linked with a database. It means I'd better to use a datacombo. Thanks to ndb I discovered the Krosoft forms controls 2. It doesn't exactly reply to my problem but it helped me for other problem.

Thanks a lot for trying to help me.