我在datagridview中有一个DataGridViewComboBoxCell。我在form_load中加载值。它最初在DataGridViewComboBoxCell中显示为空白,当添加新行时。但我的问题是我如何设置默认值,说“其他” DataGridViewComboBoxCell.So 每当我尝试添加新行时,它都会在其中显示默认项。
我想向您展示我的代码。
DataGridViewComboBoxCell comboItem_current = dataGridView1.CurrentRow.Cells[2] as DataGridViewComboBoxCell;
comboItem_current.Items.Clear();
comboItem_current.Items.Add("Other");
foreach (DataRow dr in ds_Item.Tables[0].Rows)
{
DataGridViewComboBoxCell comboItem1 = dataGridView1.CurrentRow.Cells[2] as DataGridViewComboBoxCell;
comboItem1.Items.Add(dr[1].ToString());
}
请帮忙....谢谢