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.
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.
If you are using DataGridView1.EditMode = DataGridViewEditMode.EditOnEnter
you can't delete any row
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With