private void LoginBtn_Click(object sender, EventArgs e) { if (LoginDB.Login(UsernameTxt.Text, PasswordTxt.Text)) //logged in was returned true { this.Hide(); //hide login frmMain MainMenu = new frmMain(); //start new form MainMenu.ShowDialog(); this.Close(); //when dialog returns control to login form, close imediatly } else { MessageBox.Show("Username or password were incorrect."); PasswordTxt.SelectAll(); PasswordTxt.Focus(); } }
private void frmPackage_FormClosing(object sender, FormClosingEventArgs e) { frmMain main = new frmMain(); main.DisplayPackages(); }