I have a hopefully simple issue that I can't figure out. I have a list of items that I load from a stored procedure into the list box. When I click on a value I can't get the value.
If I were to populate the listbox manually it works. I've populated my issues.
--This Code is used to load the ListBox
Public Sub LoadListBox(ByVal lstListBox As ListBox, ByVal strType As String)
' loads a stored proc into a data table
'if Commercial we don't want to load the Factory ListBox
'If Not bolFactory And lstListBox.ID = "lstFactory" Then Exit Sub
Dim SqlCmd As SqlCommand = New SqlCommand()
SqlCmd.Connection = SqlConn
SqlCmd.CommandText = "Ringgold_Security_Users"
SqlCmd.CommandType = CommandType.StoredProcedure
' Create a DataReader
Dim theReader As SqlDataReader
theReader = SqlCmd.ExecuteReader
'Iterate through the results
Dim intTmp As Integer
intTmp = 0
lstListBox.Items(intTmp).Value = theReader(0).ToString
'If UCase(theReader(1)) = "Y" Then lstListBox.Items(intTmp).Selected = True
intTmp = intTmp + 1
SqlCmd = Nothing
theReader = Nothing
--This code here I use to get the value when I select the value on the ListBox.
Dim list As String = ListBox1.SelectedItem.Text