andrew
andrew

Reputation:

Delete DataGridView line

How can I delete a line form a bound DataGridView when pressing the Delete key?

Upvotes: 0

Views: 1107

Answers (1)

paulwhit
paulwhit

Reputation: 8878

If you're on framework 3.5, it looks like there's a method on the DataGridView to process the delete key.

http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.processdeletekey.aspx

Otherwise, I would suggest capturing the form keypress event and working backwards to get the active/selected DataGridView row to know which one to process.

Upvotes: 1

Related Questions