How Can I get Selected Value when user selects item from combo box

shepmom

Member
Joined
Aug 18, 2010
Messages
9
Programming Experience
Beginner
I am creating the items in a combo box in my code behind. I am setting the display member and the value member.

When the user makes a selection from the combo box, I need to get the value of the selected item. I have written some code, but when I step through it, it says that the selectedvalue is Nothing. Any ideas??

Here is the code where I am creating the items in the combo box:
Do While drReader.Read
cboTheater.Items.Add(drReader("TheaterDesc"))
cboTheater.ValueMember = CStr(drReader("TheaterID"))
cboTheater.DisplayMember = CStr(drReader("TheaterDesc"))

Loop

In the selected index change event for the combo box, I am doing the following:

Dim strTheater As String

strTheater = CStr(cboTheater.SelectedValue)

When I step thru the code, strTheater is Nothing
 
Hi,

When you're stepping through your code, does cboTheater.SelectedValue have a value?
 
Back
Top