Solved

multi column ComboBox

Posted on 2000-03-14
8
356 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 2616156
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
ID: 2616193
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
ID: 2616237
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Expert Comment

by:pinshah
ID: 2616269
Bound both the combo and the Text box with same recordset.
0
 
LVL 1

Accepted Solution

by:
ndb earned 100 total points
ID: 2616367
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
ID: 2616373
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
ID: 2618294
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
ID: 2618784
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Spell Check in VB6 13 152
Passing a Text Box name to a Sub 6 104
I need help embedding an image as HTML in my vb.net application 3 85
Export Data to Different .csv Files 27 133
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

752 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