.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Sandeep Singh

Home >> Code Snippets >> DataGrid >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Editable ComboBox in Datagridviewcolumn

Posted By:Mohanraj       Posted Date: July 17, 2012    Points: 40    Category: DataGrid    URL: http://www.dotnetspark.com  

To make the Editable DatagridviewComboBoxcolumn which contains n number of items we can use the datagridview EditingControlShowing Event. By using this event we can avoid scrolling the entire list for selecting a single item. Instead of that we can just type the first letter of the item then the combobox will dropdown the suggestions, from the suggestions we can select the required item


DataGridViewComboBoxColumn combo1 = new DataGridViewComboBoxColumn();

combo1.DisplayStyle = DataGridViewComboBoxDisplayStyle.ComboBox;

combo1.DataSource = tdotsupp;//Fill the item from the datasource


private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)


ComboBox com = e.Control as ComboBox;

if (com != null)


com.SelectedIndex = -1;

com.DropDownStyle = ComboBoxStyle.DropDown;

com.AutoCompleteMode = AutoCompleteMode.SuggestAppend;

com.AutoCompleteSource = AutoCompleteSource.ListItems;




Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend