How to delete DataGridView Row by pressing DeleteKey?
c#, datagridview, winforms
Solution
One possible cause for the delete functionality not working is that you need to have a row selected.
This means either having the `SelectionMode` set to `FullRowSelect` or means that you have previously clicked on the row headers which are to the left of the columns.
Problem
I have a DataGridView on a form. I want to delete rows from the grid by pressing the delete key, but delete key seems to be dead, until I enter into `CellEditMode`. If I enter to `CellEditMode` then the delete key works, but obviously only for deleting cell contents, not for deleting rows. The DataGridView has `AllowUserToDeleteRow = true` and the grid is unbound. I have other grids where this function works correctly, but can't see the difference.