How can I delete a line form a bound DataGridView when pressing the Delete key?
How can I delete a line form a bound DataGridView when pressing the Delete
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.