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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ComboBox Value! Pls Help 1

Status
Not open for further replies.

Bernini

Programmer
Oct 26, 2004
98
MT
Hi all

I would like to create a combo box with a list of Company Names, but i would also like to add a value with each Name. Therefore once the company is chosen an id can be extracted from it!

How can i do this? The combobox is not data bound just data inserted!

Thanks
B
 
One possibility...

you could set up an array that has the id's in it corresponding to the items in the combo box

When the user selects a combobox item just use the selected index to pull the id from the array
 
Take a look at thread732-949121

It's C#, but the same technique applies -- you create a small class to hold everything about that item in your combobox, then just store the instance of that class in the combo. In order to get it to display correctly, you override the ToString() method.

This works because the Item property of a combobox is of type Object, and not String, Int, etc.

Chip H.


____________________________________________________________________
Click here to learn Ways to help with Tsunami Relief
If you want to get the best response to a question, please read FAQ222-2244 first
 
thanks jubble...to tell u, i've already about that...wouldn't it slow the system or?

would there be another more better way to do it?


Thanks
Nick
 
Chiph it looks good! thanks ...here's a star! cheers!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top