Public Sub AutoCompleteDropDown(ByVal str As String, ByVal AutoDropDown As ComboBox, ByVal strText As String) Try AutoDropDown.AutoCompleteCustomSource = Nothing Dim dt As DataTable = GetTable(str) If dt.Rows.Count > 0 Then For Each prow As DataRow In dt.Rows AutoDropDown.Items.Add(prow(0)) Next Else MessageBox.Show("No " & AutoDropDown.Name.Remove(0, 3) & " exists", strText, MessageBoxButtons.OK, MessageBoxIcon.Information) Exit Sub End If AutoDropDown.AutoCompleteMode = AutoCompleteMode.Suggest AutoDropDown.AutoCompleteSource = AutoCompleteSource.ListItems DropDownCollection.Clear() For Each drjob As DataRow In dt.Rows DropDownCollection.Add(drjob(0).ToString()) Next AutoDropDown.AutoCompleteCustomSource = DropDownCollection Catch ex As Exception MessageBox.Show(ex.Message, strText, MessageBoxButtons.OK, MessageBoxIcon.Information) End Try End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)