i wanna display a combox in a datagrid. here is the main code. but i get error with message that "handle the dataerror event"
private void Form2_Load(object sender, EventArgs e)
{
System.Windows.Forms.DataGridViewComboBoxColumn Column1;
DataTable table = new DataTable("t");
table.Columns.Add("col1");
table.Columns.Add("col2");
table.Rows.Add(table.NewRow());
table.Rows.Add(table.NewRow());
table.Rows.Add(table.NewRow());
table.Rows.Add(table.NewRow());
table.Rows[0][0] = "furqan";
table.Rows[0][1] = "1";
table.Rows[1][0] = "sulman";
table.Rows[1][1] = "2";
table.Rows[2][0] = "asdfass";
table.Rows[2][1] = "3";
table.Rows[3][0] = "ghiojf";
table.Rows[3][1] = "4";
DataSet myDataSet = new DataSet("dsname");
myDataSet.Tables.Add(table);
Column1 = new System.Windows.Forms.DataGridViewComboBoxColumn();
Column1.DataSource = myDataSet.Tables[0];
Column1.ValueMember = "col2";
Column1.DisplayMember = "col1";
Column1.AutoComplete = true;
dataGridView1.Columns.Add(Column1);
DataGridViewComboBoxCell cell = new DataGridViewComboBoxCell();
cell.DataSource = myDataSet.Tables[0];
cell.DisplayMember = "name";
cell.ValueMember = "id";
object[] a = new object[1];
a[0] = cell;
dataGridView1.Rows.Add(a);
}
whats the problem ???