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

Listbox text and values

Status
Not open for further replies.

johnrg1

Programmer
Jan 24, 2003
38
GB
In the web listbox, there isa command to add an item with a seperate value,
listbox1.item.add(new listitem(VALUE,"TEXT"))

But I can not find anything like it in the windows form listbox.

It is possible to do this through databinding, but i am not using a dataset, i want to add the items through code.
so that say a customers name is displayed, but the value it the customerID.

Any one managed this?

Cheers
 
If you are not doing any data binding and you are just adding items what purpose will the value property serve for you. I guess I am asking, outside of adding new items, what else are you trying to achieve?
 
Thank you for your reply, however, i have now sorted it.

Thanks

John
 
Instead of doing:
Select Case listbox.selectedindex
Case 0
myString = "value1"
Case 1
myString = "value2"
End Select
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top