private void LoginForm_Load(object sender, EventArgs e) { if (!Varibles.getValidConnection()) { try { DBConfiguration form = new DBConfiguration(); this.Hide(); form.ShowDialog(); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }