我有我的datagridview 3列: Motor | TextBox | TextBox不要让用户在已经选择的DataGridView中的组合框中选择一个值
我的组合框有一些用户可以从中选择的枚举值。
和用户倾斜允许从我的枚举选择1个值1倍以上..
希望maked我的问题很清楚:d
private void dataGridView1_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
{
for (int i = 0; i < dataGridView1.Rows.Count-1; i++)
{
if (dataGridView1.Rows[i].Cells[0].Value == e.FormattedValue)
{
MessageBox.Show("Value already selected");
e.Cancel = true;
}
}
}
不似乎工作像我将有它到
我想使2路的? foreach .. – DumaSexy 2011-03-09 09:18:14
你可以这样写:'for(int i = 0; i
0x49D1
2011-03-09 10:01:29
e.Value does not exit:S – DumaSexy 2011-03-09 10:16:38