I want to retrive data from table into combobox ..when the user click combobox items it's corresponding data will be show.
In details :
I have PERSON table , my program allow to the user search by : Person Name
When the user enters the name into TextBox the combobox items will be all
names existed in database same which user entered.
when the user selects item from combobox a new form will show all person' data
here what I tried
Me.PersonComboBox.DataSource = tblPerson ' tblPerson = DataSet.Tables("PERSON")
Me.PersonComboBox.DisplayMember="FirstName"
Me.PersonComboBox.ValueMember="PersonID" ' PersonID is tblPerson PK
but that code shows all names , It does not allow to (Select .... Where Name = ... )
Also tried this:
For Each dr In tblPerson.Select("FirstName ='" & Me.nameTextBox.Text & "' ")
Me.PersonComboBox.Items.Add(dr("FirstName").ToString & " " & dr("LastName").ToString)
Me.PersonComboBox.ValueMember = dr("PersonID")
Next
but Combobox (SelectedIndexChanged) event always show just last item data
Thanks alot for your help
:)