Click here to Skip to main content
15,895,667 members
Please Sign up or sign in to vote.
2.60/5 (2 votes)
See more:
I have a data grid view which is used to bind values, I have a combo box inside this data grid view, I want to implement an auto complete property in this combo box... It should not only search for the first letter but the whole item...

What I have tried:

I have looked for the codes since the combo box is inside the data grid view, I cannot seems to find a solution
Posted
Updated 10-Apr-16 10:26am

1 solution

Hi Sajin

Have you tried using EditingControlShowing event of the Datagridview?

C#
if (e.Control is DataGridViewComboBoxEditingControl) //check for the id in case multiple columns with dropdown and you need specific.
            {
                ((ComboBox)e.Control).DropDownStyle = ComboBoxStyle.DropDown;
                ((ComboBox)e.Control).AutoCompleteSource = AutoCompleteSource.ListItems;
                ((ComboBox)e.Control).AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
            }



Hope this helps.
 
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