// Windows form Close button handler #region Close button handle protected override void OnFormClosing(FormClosingEventArgs e) { base.OnFormClosing(e); if (e.CloseReason == CloseReason.WindowsShutDown) { return; } // Confirm user wants to close switch (MessageBox.Show(this, "Are you sure you want to Log out?", "Closing", MessageBoxButtons.YesNo)) { case DialogResult.No: this.Hide(); Login.Login obj = new Login.Login(); obj.Show(); break; default: break; } }
// Logout function #region LogOut private void LogOut_btn_Click(object sender, EventArgs e) { this.Hide(); Login.Login obj = new Login.Login(); obj.Show(); }