|
-
Nov 22nd, 2021, 08:17 AM
#1
Thread Starter
Fanatic Member
[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?
Last edited by sgrya1; Nov 22nd, 2021 at 01:07 PM.
-
Nov 22nd, 2021, 12:53 PM
#2
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.
-
Nov 22nd, 2021, 02:11 PM
#3
Thread Starter
Fanatic Member
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!
-
Nov 22nd, 2021, 09:51 PM
#4
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|