Click Event
DialogResult dr = MessageBox.Show("Do you want to delete a record", "Test", MessageBoxButtons.YesNo); if (dr == DialogResult.Yes ) { // DO Sommthig(Delete a record) } else if (dr == DialogResult.No) { //Do Something(Error message) }