views:

44

answers:

1

How can I remove the current cell focus from a Windows Forms datagridview ? I have a dialog with some datagridforms and initially I don't want to have a cell selection. Actually in every gridview the cell [1,1] is selected

I have already searched in some forums, but the provided solutions doesn't work. For example often it is recommended to set CurrentCell = null --> but this has no effect. Has anybody another solution, which really works ;-) ?

+1  A: 

I think this will work:

if (dataGridView.RowCount > 0 && dataGridView.ColumnCount >0)
{
   dataGridView.CurrentCell = this.dataGridView[0, 0];
   this.dataGridView.CurrentCell.Selected = false;
} 
Elmex