Problem Deleting Data from DataGridView

Hi.

I am using a DataGridView control, when I select a row in this control and type "Supr" key, the row that I selected is deleted of DataGridView Control.

I want to display a Messagebox after typing "Supr" key asking: "Are you sure you want to delete this row ", if user select "No" button, the row shouldn’t be deleted of DataGridView, but if user select "Yes" button, the row should be deleted of DataGridView control.

I tried to do this using RowsRemoved event,but it 's impossible because this event is executed after the row is deleted.

Could you tell me which event I should use , and what method or procedure is necessary to reject the elimination of the row in the case that I have selected "No" in MessageBox control . I would appreciate if you send me an example code.

Thank you.

Best regards.



Answer this question

Problem Deleting Data from DataGridView

  • Problem Deleting Data from DataGridView