private void btnLogOut_Click(object sender, EventArgs e) { string message = "Do you want to Logout?"; string title = "Logout"; MessageBoxButtons buttons = MessageBoxButtons.YesNo; DialogResult result = MessageBox.Show(message, title, buttons); if (result == DialogResult.Yes) { LoginPanel objlp = new LoginPanel(); this.Hide(); objlp.Show(); } }