I have a combo box on a binding control. It is bound to a name column in my dataset. It works like it should, but I need the autocomplet to be able to find names by either first name or last name. For example, if I have two names in the name column,
John Smith and
Bob Jones

My user then types in "Jo", I need the dropdown to have both John Smith and Bob Jones listed. Because J and O are the first characters in both a first name and the last name.

Anyone know how I can do this with autocomplete?

Thnks,
Jason

Recommended Answers

All 3 Replies

I haven't tried but it is likely tied to your SELECT statement.

try...

WHERE Name LIKE '%" & combobox1 & "%'"

I haven't tried but it is likely tied to your SELECT statement.

try...

WHERE Name LIKE '%" & combobox1 & "%'"

I am not using SQL SELECT. I just created a new collection string from a bound table and assigned it to the autocomplete custom source. I could use code to do it, but wanted to know if there was a way to accomplish it through the autocomplete functionality.
Below is my code:

Dim acFirstName As New AutoCompleteStringCollection
For Each dr As DataRow In Me.WaterworksDataSet.Tables("WorkOrders").Rows
     acFirstName.Add(dr.Item("Name").ToString) 
Next
NameTextBox.AutoCompleteCustomSource = acFirstName

i m not sure if this like what u want
i m using cmbTets.FindString()

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.