Private scAutoComplete As New AutoCompleteStringCollection
Private Sub bindGrid() DataGridView1.DataSource = getTable() ' To get Data Table for the Grid View setAutoComplete()End SubPrivate Sub setAutoComplete() For i As Integer = 1 To 5 scAutoComplete.Add("Praveen " & CStr(i)) ' For Sample i added my name here you can load values from database NextEnd Sub
Private Sub DataGridView1_EditingControlShowing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewEditingControlShowingEventArgs) Handles DataGridView1.EditingControlShowing If DataGridView1.CurrentCell.ColumnIndex = 1 AndAlso TypeOf e.Control Is TextBox Then ' Checking Whether the Editing Control Column Index is 1 or not if 1 Then Enabling Auto Complete Extender With DirectCast(e.Control, TextBox) .AutoCompleteCustomSource = scAutoComplete .AutoCompleteMode = AutoCompleteMode.SuggestAppend .AutoCompleteSource = AutoCompleteSource.CustomSource End With Else ' we are not Enabling Auto Complete Extendar With DirectCast(e.Control, TextBox) .AutoCompleteMode = AutoCompleteMode.None End With End IfEnd Sub