关于DataGridViewComboBoxColumn的选中问题
在winform项目中。有一个dataGridView,里面设置了一个列为“DataGridViewComboBoxColumn”
赋值代码如下,没问题
private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
if (dataGridView1.CurrentCell.ColumnIndex == 0)
{
ComboBox c = ((ComboBox)e.Control);
c.SelectedIndexChanged+=new EventHandler(c_SelectedIndexChanged);
if (c.Items.Count == 0)
{
foreach (System.IO.FileInfo f in realFiles)
{
c.Items.Add(f.Name);
}
c.SelectedIndex = 0;
}
else
{
c.SelectedIndex = 0;
}
}
}
我这个grid是打开了自动增加新行的。
选择后,点击其他单元格的时候,下拉列表的显示为空,我选中的值没有显示到上面,不知道是什么问题,请大家帮忙下。