我对设置/获取组合框字段的选定索引感到困惑。
this.Parameter.DataSource = lambdacat.Dict();
{
foreach (DataGridViewRow row in LimView.Rows)
{
//( (ComboBox)row.Cells[1] ) ???
}
}
是的,这不起作用:)
谢谢
答案 0 :(得分:4)
您可以使用
(row.Cells[1] as DataGridViewComboBoxCell).Value == yourvalue;
并将所选值设为
(row.Cells[1] as DataGridViewComboBoxCell).FormattedValue
设置默认选定值
(row.Cells[1] as DataGridViewComboBoxCell).Value =(row.Cells[1] as DataGridViewComboBoxCell).Items[yourneededindex]