我使用使用gridViewProducts.Rows.Add(dViewRow);
如何添加ComboBox到C#中的DataGridViewRow?
DataGridViewRow dViewRow = new DataGridViewRow();
DataGridViewTextBoxCell Sno = new DataGridViewTextBoxCell();
DataGridViewComboBoxCell dgCombo = new DataGridViewComboBoxCell();
dViewRow.Cells.Add(Sno);
dViewRow.Cells.Add(dgCombo);
dViewRow.Cells[0].Value = 1;
dViewRow.Cells[1].Value = "ASP";
然後我綁定DataGridViewRow
到主DataGrid
代碼,但我收到以下錯誤:
System.ArgumentException:DatagridviewCombobox值無效
使用模板列。 – 2012-02-14 06:09:14
你有沒有附加到'ComboBoxColumn'的任何數據源?錯誤意味着值(ASP)對組合框不可用/有效。所以請添加相同的細節 – V4Vendetta 2012-02-14 06:13:12