private void btnExit_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("Are you sure you want to exit?", "Confirm Exit", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { sql.Backup(); Close(); //Exit the program } }