所选项目的DataGridView的组合框失败目的、组合、选项、DataGridView

由网友(泽风飘渺)分享简介:我有设置的混乱/获取选择组合框里面的字段的索引。I've got confusion of setting / getting selected indexes of combobox fields inside.this.Parameter.DataSource = lambdacat.Dict();{foreac...

我有设置的混乱/获取选择组合框里面的字段的索引。

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] 
阅读全文

相关推荐

最新文章