I am having trouble using a bindingsource to select an item in a combobox. I populate the combobox no problem, the items are listed. I double checked that my binding source contains information.
Combobox has a displaymember (text) and valuemember(integer)
my bindingsource contains the valuemember.
How do i bind the combobox to bindingsource so it shows the correct displaymemeber based on the valuemember stored in bindingsource.
this is what i have tried
cboAccessLevel.SelectedValue = EditMembershipBindingSource("accesslevelid")
I am using vb.net
here is bindingcode
strSQL = "select * from memberships where name = " & "'" & MembershipName & "'"
Using Connection As New SqlConnection(ProgramSQLConnection)
Connection.Open()
Dim Command As New SqlClient.SqlCommand(strSQL, Connection)
Dim MyAdapter As SqlDataAdapter = New SqlDataAdapter
MyAdapter.SelectCommand = Command
dtSpecificMembership = New DataTable
MyAdapter.Fill(dtSpecificMembership)
EditMembershipBindingSource.DataSource = dtSpecificMembership
Connection.Close()
End Using