private void btnLogin_Click(object sender, EventArgs e) { if (uNameTxt.Text == "" || passwordTxt.Text == "") { MessageBox.Show("Both Username and Password fields are mandatory, please fill them in.", "Username or password fields are blank", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } bool validUser = dbstuff.decrypteUser(uNameTxt.Text, passwordTxt.Text); if (validUser) { Console.WriteLine(User.UserID); HPage.getInstance().Show(); this.Hide(); //authenticated.getInstance().Show(); // getInstance().Hide(); } else { MessageBox.Show("Your username or password is incorrect, please try again or register a new account.", "Username or password incorrect.", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public static Form getInstance() { if (hPage == null) { hPage = new HPage(); } return(hPage); }