private void btn_Yes_Click(object sender, EventArgs e) { form.Close(); Frm_Login login = new Frm_Login(); login.Show(); this.Close(); }
protected override void OnFormClosing(FormClosingEventArgs e) { base.OnFormClosing(e); if (e.CloseReason == CloseReason.WindowsShutDown) { return; } switch (MessageBox.Show(this, "Are you sure you want to exit? Any unsaved changes will be lost.", "Closing", MessageBoxButtons.YesNo)) { case DialogResult.No: e.Cancel = true; break; default: Frm_Login frmlogin = new Frm_Login(); frmlogin.Show(); break; } }