首次加载CurrentRow
时,是否可以在DataGridView
到null
设置Form
?我想这样做,因此CurrentChanged
上的BindingSource
事件无法触发。
为了澄清,最初加载Form
时,我不希望在DataGridView
中选择任何行。我希望BindingSource.CurrentChanged
仅在用户选择一行时触发。
答案 0 :(得分:0)
CurrentRow是只读的。
我认为你应该将CurrentCell设置为null。
答案 1 :(得分:0)
为什么不在事件中设置e.Cancel = true;
取消它?
答案 2 :(得分:0)
您可以使用this.dataGridView1.ClearSelection();
方法清除行选择。我不知道它是否适用于你的场景。
答案 3 :(得分:0)
尝试
foreach(DataGridViewCell Cell datagridview1.SelectedCells)
{
Cell.Seleted=false;
}
我希望这能解决你的问题。