private void ConfirmBtn_Click(object sender, EventArgs e) { const string message = "Confirm start trip? "; const string caption = "Start Trip"; var result = MessageBox.Show(message, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question); // If the no button was pressed ... if (result == DialogResult.No) { // cancel the closure of the form. } else { string carNumber = carNo.Text; ParcelController.StartTransit(branchId, nextBranch, carNumber, trackingNumList); this.Close(); admin.ViewParcelInBranch(); } }