I'm setting the datasource of a DataGridView to a datatable. This
loads the grid correctly but it automatically selects the first row in
the grid, triggering the SelectionChanged event. Is there a way to
stop the grid from automatically selecting the first row?
Thanks.
Try handling the DataBindingComplete() event and setting selectedIndex = -1.

Signature
He who dies with the most toys wins.
> I'm setting the datasource of a DataGridView to a datatable. This
> loads the grid correctly but it automatically selects the first row in
> the grid, triggering the SelectionChanged event. Is there a way to
> stop the grid from automatically selecting the first row?
>
> Thanks.
Nkem - 19 Apr 2006 17:56 GMT
You would just as well do this: datagridviewname.ClearSelection(); right
after loading data.
> Try handling the DataBindingComplete() event and setting selectedIndex = -1.
>
[quoted text clipped - 4 lines]
> >
> > Thanks.