Your solution completely discouples the listbox items from the database table so you can't identifiy the required database record by selected index. Better: create a simple class that holds the primary key and the field used for display in the listbox. Overwrite the ToString method of that class to return the diplay text. Then create an instance of that class for every record in your table and add this object as item to your listbox. When selectioin is made, cast the selecteditem back to the class type and read the primary key. Then query your database table for that key which always return exactly the one matching record. This will solve all your problems. A quick example, assuming your primary key is Guid (for int change the ID property type to Integer):
Private Class clsListBoxItem
Public Property ID As Guid = Nothing
Private Name As String = String.Empty
Public Sub New(ByVal PK As Guid, ByVal DisplayName As String)
ID = PK
Name = DisplayName
End Sub
Public Override Function ToString() As String
Return Name
End Function
End Class
Fill the ListBox:
MyListBox.Items.Clear
If Reader.HasRows
Do While Reader.Read()
Dim objItem As New clsListBoxItem(Reader.Item("ID"), _ Reader.Item("Question")
MyListBox.Itms.Add(objItem)
Loop
End If
'Get the selected item:
Dim objItem As clsListBoxItem = TryCast(MyListBox.SelectedItem, clsListBoxItem)
Dim PK As Guid = objItem.ID
Dim strSELECTCmd = "SELECT * FROM elect WHERE (ID = @ID)
'Set SQL parameter here and execute the query....
Good luck!