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

List Box Selected Item

Status
Not open for further replies.

GazzaN

Instructor
Mar 29, 2005
18
GB
We have a listbox and hae selected the item from the list we want and yet cannot appear to transfer the value to label elsewhere. What property stores the value selected from the list of items?
 
ListBox1.SelectedItem

returns the text of what is selected

-bclt
 
ListBox1.SelectedItem will actually return the Object that is currenty selected. If you populated the list box with strings, this will work fine. If you populated it with a dataset, it will return {datarow}. In that case you want to use:

ListBox1.SelectedValue

which will return the Value member of the selected item.

-Rick

----------------------
[banghead]If you're about to post an ASP.Net question,
please don't do it in the VB.Net forum[banghead]

[monkey] I believe in killer coding ninja monkeys.[monkey]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top