Click here to Skip to main content
15,895,084 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Everyone,

I am having trouble with textbox autocomplete in my datagridview control. What I want to happen here is to enable the autocomplete in datagridview column 1 only and the rest columns (2,3, so on, so forth), autocomplete feature should be disabled. The autocomplete works fine when I tested it, but unfortunately, when the autocomplete was triggered from the specified column (column 1), it also worked with the other column cells as if the auto complete is available to all the cells in datagridview even if I specified in my validation is columnIndex = 1 only... I want the textbox autocomplete disabled to col2,3, so on, so forth cells. Please help me out guys.

Below is the code I used in my datagridview_EditingControlShowing event:

Private Sub dgvPOItems_EditingControlShowing(sender As Object, e As System.Windows.Forms.DataGridViewEditingControlShowingEventArgs) Handles dgvPOItems.EditingControlShowing

Dim TX As TextBox = CType(e.Control, TextBox)
If dgvPOItems.CurrentCell.ColumnIndex = 1 Then

If Not IsNothing(TX) Then

TX.AutoCompleteCustomSource = gacInventoryItemsLookUp
TX.AutoCompleteMode = AutoCompleteMode.SuggestAppend
TX.AutoCompleteSource = AutoCompleteSource.CustomSource

End If
Else
TX = Nothing
End If

End Sub
End If

Note: gacInventoryItemsLookUp is supplied upon program initialization.

Thanks,
Posted
Updated 19-Mar-14 0:41am
v2

 
Share this answer
 
Comments
alvin talavera 19-Mar-14 5:29am    
Hi Abhinav,

Thank you for the link. The code is not different to my code, they have the same function. What I want to happen is- when I try to type a character on the cells under column 2,3 so on, so forth, auto complete list should not appear. The said columns (2,3 so on, so forth) act as ordinary cell nothing more.
Hi Guys,

I resolved my trouble myself. I hope everyone will participate on my next thread.

Thanks
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900