I have two windows form.
- Login Screen
- Home Screen
On home screen, I have a tab control that have 4 tabs (tab pages).
On my login screen, I have a login functionality which allows user and admin to login. On home screen, in tabControl I have a tab page 'User Management' that I only want to display when admin logs in.
This is the login btn click function I have:
private void button2_Click(object sender, EventArgs e)
{
Form1 mForm = new Form1();
if (textBox3.Text.ToLower() == "admin" && textBox4.Text.ToLower() == "admin")
{
mForm.Show();
this.Hide();
}
else
{
MessageBox.Show("Please enter valid id and password", "Incorrect Credentials", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
I want to add an else condition that will validate "user" credentials but then I want to hide that one tab page on my Form1 windows form.
Is there any way to do that?