所选项目的DataGridView的组合框失败 [英] Set selected items for DataGridView ComboBox failed
本文介绍了所选项目的DataGridView的组合框失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有设置的混乱/获取选择组合框里面的字段的索引。
I've got confusion of setting / getting selected indexes of combobox fields inside.
this.Parameter.DataSource = lambdacat.Dict();
{
foreach (DataGridViewRow row in LimView.Rows)
{
//( (ComboBox)row.Cells[1] ) ???
}
}
是的,这不工作:)
yes , this doesn't work :)
谢谢
推荐答案
您可以使用
(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]
这篇关于所选项目的DataGridView的组合框失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文