DavidGreenfield
asked on
Datagridview - always selects first row - how can I stop this
hi there
Whenever I load data into a datagridview the first row is always selected. In VB6 days on an MSflexgrid there used to be a highlight on focus command where a row only become selected when a user clicked on the row.
How can I emulate this behaviour?
many thanks!!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
That is a better way ;-)
Although it doesn't work for me in resize, it does once the binding is complete.
Roger
Although it doesn't work for me in resize, it does once the binding is complete.
Roger
What then happens is that although the top left cell is then "selected" by default, it is so small that the user can hardly see it and, in any event, its color shows no indication of that selection: it just looks like a slightly wider border on the left edge of the grid.
Then, as soon as a "real" cell is clicked, you can reset selection mode to FullRowSelect if that is what you prefer.
Obviously, you will also then need to take account of the extra column in any code which relies on column indexes.
Roger