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

I have datagridview. I was change datacolum type to DataGridViewComboBoxColumn;

but when I binding datasource to my datagrid have this error :the following exception occurred in the datagridview .
system.ArgumentException:DataGridViewComboBoxCell value is not valid

to replace this defult dialog please handle the dataerror event;

Can you Help me?
Updated 19-Oct-11 0:17am

1 solution

When you create a column of combo boxes, those combos must be assigned a list of items which will be displayed when you select it. The value which goes into the dgv cell must be in that list of items. In your case, one or more of the combo box cells contains a value which is not in the item list, hence the cell value is invalid.
Share this answer
raheleh_es 22-Oct-11 0:26am    
how Can I add combo box cell for all row when I set dataset to data grid view ;

...I wrote this code but it does n't work:datagridview.DataSource = ds;

datagridview.DataMember = "selectE";

DataGridViewComboBoxCell cell = new DataGridViewComboBoxCell();

for (int i = 0; i < ds.Tables["Post"].Rows.Count; i++)




for (int j = 0; j < ds.Tables["selectE"].Rows.Count; j++)

{ datagrid_Name181[0,j] = cell;


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