I have this project where you can login as a user and as an employee and if you log in as an employee certain buttons such as reports will show up on the homepage.
I have two forms named HomePage
and frmSignIn
. If the user signs in from frmSignIn
I want certain button on HomePage
to be visible. I have tried several ways but cannot get it to work.
I did make the button public
to see if it works, although I know this is bad practice.
if (ValidCredentials(txtUsername.Text, txtPassword.Text) == true && checkBoxEmployee.Checked == true && txtBoxEmpPin.Text.Equals(employeePin))
{
this.DialogResult = DialogResult.OK;
this.Tag = _usersId;
this.Close();
MessageBox.Show("You have successfully logged in as an employee.");
HomePage hp = new HomePage();
hp.Button.Visible = true; // !!!! Does not work !!!!
}