Is there way to set CurrentRow
in a DataGridView
to null
when a Form
is first loaded? I want to do this so the CurrentChanged
event o开发者_如何学运维n my BindingSource
does not fire.
To clarify, when the Form
is initially loaded, I don't want any rows to be selected in my DataGridView
. And I want BindingSource.CurrentChanged
to fire only when the user selects a row.
CurrentRow is readonly.
I think you should set the CurrentCell to null.
Why don't you set e.Cancel = true;
in the event to cancel it?
You can clear the row selection using this.dataGridView1.ClearSelection();
method. I don't know whether it is work with you scenario or not.
Try
foreach(DataGridViewCell Cell datagridview1.SelectedCells)
{
Cell.Seleted=false;
}
i hope this will solve your problem.
精彩评论