/** * This method defines */ private void ManageTeams_FormClosing(object sender, FormClosingEventArgs e) { DialogResult result = MessageBox.Show("Do you really want to the main form?\n", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (result == DialogResult.Yes) { var main = new MainForm(); main.Show(); } else e.Cancel = true; }
/** * This method defines what happens when the form is closing */ private void AddSalesman_FormClosing(object sender, FormClosingEventArgs e) { DialogResult result = MessageBox.Show("Do you really want to exit to main form?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (result == DialogResult.Yes) { MainForm x = new MainForm(); x.Show(); } else e.Cancel = true; }