So basically the very first column in the first row is always selected, I can't figure out a way to have it so the gridview has no selected cells. Any help?
views:
61answers:
2
A:
Try
gridView.ClearSelection();
If you want the selected cells cleared when a form loads, try putting that in the form's Load event handler.
kevev22
2010-10-08 16:03:47
A:
Set the DGV's CurrentCell
property to null after data binding the DGV:
dataGridView1.CurrentCell = null;
Note that doing this won't prevent DGV events associated with row and cell selection from firing; you'll have to add selected row or cell count checks on RowEnter events, something like this:
private void dataGridView1_RowEnter(object sender, DataGridViewCellEventArgs e) {
if (dataGridView1.SelectedRows.Count == 1) {
// Do stuff since a row is actually selected ...
}
}
Jay Riggs
2010-10-08 16:07:35