When the user clicks the Delete button on a BindingNavigator, the delete occurs immediately.

I can arrange for the user to cancel the delete later, but that assumes the user realizes that a record was deleted in the first place, so I prefer to warn them when the button is clicked. I would like to display a dialog asking the user to confirm the delete operation before hand, and cancel the delete if the user does not confirm it. I have not identified a good way to do that.

The row is already deleted by the time the Click event on the button occurs.

The DataTable.RowDeleting event does not provide a Cancel property in DataRowChangeEventArgs.

Is there a way to trap this event

9 Years
Discussion Span
Last Post by fishsqzr

First thing you will do is
set BindingNavigator' s DeleteItem to none from the properties box
Doing this, the button will still show but the default event is gone.

Double click afterwards on the delete button and include a similar code like that,

private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e)
            if (MessageBox.Show("Sure you wanna delete?", "Warning", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)

Excellent! I imagine that same trick can be used with the other buttons. I'll try it. Thanks.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.