Solved

multi column ComboBox

Posted on 2000-03-14
8
337 Views
Last Modified: 2012-05-04
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...
0
Comment
Question by:Pleinpopossum
8 Comments
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
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.
0
 

Author Comment

by:Pleinpopossum
Comment Utility
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.
0
 
LVL 4

Expert Comment

by:vindevogel
Comment Utility
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 ....
0
 

Expert Comment

by:pinshah
Comment Utility
Bound both the combo and the Text box with same recordset.
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 1

Accepted Solution

by:
ndb earned 100 total points
Comment Utility
You can also do this with the Microsoft Forms 2.0 controls.
You can bound these controls too.
I use it because I also have a text that is shown to the user in the combobox and an index that doesn't appear to the user.
0
 
LVL 2

Expert Comment

by:damienm
Comment Utility
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
0
 

Expert Comment

by:ckhlam
Comment Utility
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.
0
 

Author Comment

by:Pleinpopossum
Comment Utility
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.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now