I have the following code to load my combo field. Can someone tell me how I could get the ID of a selected value in the combo and place it in a variable?
Code:conn.Open() Try Dim Command As New OleDbCommand("SELECT * from tbl_StaffFerndown", conn) ' Find Connection Dim dr As OleDb.OleDbDataReader = Command.ExecuteReader ' Read the data cmbUsers.BeginUpdate() ' Begin Update of the combo Do While dr.Read ' Read til no more entries ' Add ID and Username to classes and also in the combo cmbUsers.Items.Add(New ListBoxItem(CInt(dr("UserID")), dr("UserName").ToString)) Loop cmbUsers.EndUpdate() ' End the update Catch ex As Exception MessageBox.Show(ex.Message & vbCrLf & ex.StackTrace, "Error") End Try conn.Close()


Reply With Quote
