Dealy

Dealy

  • NA
  • 213
  • 0

How to abort delete action on confirmation message box

Oct 16 2009 6:30 AM
Hello,

I have the code for deleting a record but i noticed even though user cancels the action it removes the current record from the form.

Any ideas how can i stop the action when user cancel the action on the confirmation message box?

  private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e)
        {

            if (MessageBox.Show("Delete?", "Confirm Delete", MessageBoxButtons.OKCancel) == DialogResult.OK)
            MessageBox.Show("DELETE");
            else
            {
//Code for Cancel action
             MessageBox.Show("ABORT");
            }
       }


Thank you in advance.

Answers (22)