Example #1
0
        public MainForm()
        {
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            // Set the MaximizeBox to false to remove the maximize box.
            this.MaximizeBox = false;
            // Set the start position of the form to the center of the screen.
            this.StartPosition = FormStartPosition.CenterScreen;
            InitializeComponent();
            MainConn NewConObj = new MainConn();

            if (NewConObj.TestCon())
            {
                this.StartMainTable();
            }
            else
            {
                while (!NewConObj.TestCon())
                {
                    DialogResult dr = AlertGenericYesNo("Error no se encuentra la base de datos desea volver " +
                                                        "¿Desea volver a intentar conectarse?", "Error");

                    if (dr == DialogResult.Yes)
                    {
                        continue;
                    }
                    else
                    {
                        System.Environment.Exit(1);
                    }
                }

                this.StartMainTable();
            }
        }
Example #2
0
 private void backupButton_Click(object sender, EventArgs e)
 {
     if (NewConObj.TestCon())
     {
         this.NewConObj.exportDatabase();
     }
     else
     {
         MessageBox.Show("Error en la conexion a la base de datos.");
     }
 }