can anyone can help how to create a live search in vb.net 2008 using combo box.
example when i try to search a name then a press a then there should be a drop-down with a list of suggestions of name.
here is my code
Private Sub ComboBox4_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox4.SelectedIndexChanged
Dim commandString As String
ComboBox4.Items.Clear()
commandString = "SELECT * FROM dealer WHERE (fname LIKE '%" & ComboBox4.Text & "%')"
Try
Using connectionSearch As New MySqlConnection(globalConnectionString)
Using commanSearch As New MySqlCommand(commandString, connectionSearch)
commanSearch.CommandType = CommandType.Text
connectionSearch.Open()
Using reader As MySqlDataReader = commanSearch.ExecuteReader
If reader.HasRows = True Then
While reader.Read
ComboBox4.Items.Add(reader("fname").ToString)
End While
End If
End Using
End Using
End Using
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "ERROR")
End Try
End Sub