I have a problem with this code. It is login for software. I would like to limit some accessibility for each employee. But it doesn't work. Actually I make enabled=false all the options when menu is loaded.
This is code behind the form. The form has 2 textboxes,one of them is for username and the other one is for password and has one Enter button.
private void Enter_Click(object sender, EventArgs e)
{
if (txtPassword.Text == "10")
{
FormMenu a = new FormMenu();
this.Hide();
a.EmployeManagement.Enabled = true;
a.Sabtenam.Enabled = true;
a.Shora.Enabled = true;
a.HozorGhiab.Enabled = true;
a.Ketabkhane.Enabled = true;
new FormMenu().Show();
a.Refresh();
}
else
if (txtPassword.Text == "20")
{
FormMenu a = new FormMenu();
this.Hide();
a.Sabtenam.Enabled = true;
a.HozorGhiab.Enabled = true;
new FormMenu().Show();
}
else
if (txtPassword.Text == "30")
{
FormMenu a = new FormMenu();
this.Hide();
a.Shora.Enabled = true;
new FormMenu().Show();
}
else
if (txtPassword.Text == "40")
{
FormMenu a = new FormMenu();
this.Hide();
a.HozorGhiab.Enabled = true;
new FormMenu().Show();
}
else
if (txtPassword.Text == "50")
{
FormMenu a = new FormMenu();
this.Hide();
a.Shora.Enabled = true;
new FormMenu().Show();
}
else
if (txtPassword.Text == "60")
{
FormMenu a = new FormMenu();
this.Hide();
a.Ketabkhane.Enabled = true;
new FormMenu().Show();
}
else
MessageBox.Show("Invalid username or password");
}