public void login(string user, string pass) { try { LoginNew.setConnection(user, pass, txtServer.Text, LoginNew.db); LoginNew.conn.Open(); if (LoginNew.conn != null && (LoginNew.conn.State == ConnectionState.Open)) { this.txtPass.Clear(); this.txtUser.Clear(); new MainForm(this).Show(); this.Hide(); } else { MetroMessageBox.Show(this, "Access Denied", "Invalid User", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { MetroMessageBox.Show(this, ex.Message, "Access Denied", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { LoginNew.conn.Close(); } }
public MainForm(LoginNew parent) { this.parent = parent; this.LoadMainForm(); }