1
如何在选定的值更改后从datagridview组合框中获取值?如何从datagridview组合框中获取值?
如何在选定的值更改后从datagridview组合框中获取值?如何从datagridview组合框中获取值?
您可以使用:
var value = DataGridView.Rows[0].Cells[0].Value
注意:您会提供正确的行和手机号码。
,或者如果它绑定到一个对象像列表项
string value = DataGridView.Rows[RowIndex].Cells[ColumnIndex].Value.ToString();
if DataGridView.Rows[RowIndex].Cells[ColumnIndex] is DataGridViewComboBoxCell && !string.IsNullOrEmpty(value))
{
List<ListItem> items = ((DataGridViewComboBoxCellDataGridView.Rows[RowIndex].Cells[e.ColumnIndex]).Items.Cast<ListItem>().ToList();
ListItem item = items.Find(i => i.Value.Equals(value));
}
我尝试在CellContentClick事件,但没有成功读取它,你可以做这样的事情。如何在选定的值更改后读取它。 – Dusan 2011-02-18 13:22:44