[RESOLVED] Select DatagridView Row Header.
I want to delete a datagridview row by selecting the header row and hitting the Delete key.
Starting with another textbox control having focus, then clicking a datagridview row header (which highlights the row), the focus remains with (or returns to) the original control.
The only way I can delete a row is if I first enter a cell and then select the row header.
This is may already be obvious from the behaviour I describe (or possibly irrelevant) but I have "SelectionMode = FullRowSelect" and "EditMode = EditOnKeystrokeOrF2"
Can anyone suggest what tweak might be needed to fix this?
Re: Select DatagridView Row Header.
Maybe recheck your property settings. With those SelectionMode and EditMode settings all you should need to do is select a row header and press the delete key.
Re: Select DatagridView Row Header.
You are right. It does work.
For some reason I wasn't thinking CellEnter was an event triggered by clicking the row header.
In that event I had something that was taking the focus away.
Thank you!
Re: [RESOLVED] Select DatagridView Row Header.
The headers of both rows and columns are considered cells, with indexes of -1 if I'm not mistaken. If you filter for a column index of >= 0 in your CellEnter event handler then I think that you would act on only the data cells and not the row headers. You might need an additional filter for column headers too.