How to delete a DataGridView row by clicking DeleteKey?

I have a DataGridView in the form.

I want to remove rows from the grid by pressing the delete key, but the delete button seems to be dead until I log in CellEditMode.

If I enter CellEditMode, then the delete key works, but obviously only to delete the contents of the cells, not to delete the rows.

The DataGridView has AllowUserToDeleteRow = trueand the grid is not connected.

I have other lattices where this function works correctly, but I donโ€™t see the difference.

+6
source share
2 answers

One of the possible reasons the delete function doesn't work is because you need to select a row.

, SelectionMode FullRowSelect , , .

+13

- , "SelectionMode = FullRowSelect" "EditMode = EditOnKeystrokeOrF2".

, , , , "Esc", , .

"EditOnKeystrokeOrF2", .

0

All Articles