I have a datagridview and I implement the event UserDeletingRow
When I select 1 row and I press the delete-key, the UserDeletingRow event is firing 5 times. So when you look to the code, you can see I have to answer five times "are you sure..."
private void dgv_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e){ if (!e.Row.IsNewRow){ string str = ""; try { str = (string)e.Row.Cells[0].Value; } catch { ;} DialogResult resp = MessageBox.Show("Are you sure \r\n " + str, "MyApp", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (resp == DialogResult.No)e.Cancel =
true; }}

UserDeletingRow fires four/five times
Corey B
Ok, I found it.
I added the handler in code.
private void setupDgv(){
//some code
this.UserDeletingRow += new DataGridViewRowCancelEventHandler(this.dgv_UserDeletingRow);}
But I run this setup code more then once.
klaas
hackinfool