private void Principal_FormClosing(object sender, FormClosingEventArgs e) { DialogResult Opcion; Opcion = MessageBox.Show("Realmente Desea Salir del sistema", "Sistema de Ventas", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (Opcion == DialogResult.Yes) { Data.Database.Adapter ad = new Data.Database.Adapter(); ad.CloseConnection(); Application.Exit(); } else if (Opcion == DialogResult.No) { e.Cancel = true; } }
private void ExitToolsStripMenuItem_Click(object sender, EventArgs e) { Data.Database.Adapter ad = new Data.Database.Adapter(); ad.CloseConnection(); Application.Exit(); }