I can only hazard a guess at what you are asking, but if you want the username and password to both be correct before showing the form use this instead
if (tbUsername.Text == "username")
{
if(tbPassword.Text == "password")
{
AdminMainMenu x = new AdminMainMenu();
x.Show();
t.Play();
this.Dispose();
}
else
{
MessageBox.Show("Wrong password", "Error");
}
}
else
{
if(tbPassword.Text == "password")
{
MessageBox.Show("Wrong username", "Error");
}
else
{
MessageBox.Show("Wrong username and password", "Error");
}
}
4
solved Issue validating user credentials in custom authentication form [closed]