Hey everyone,

I am completely new to this forum business so I apologize if I post something wrong or something.

Anyways,

I am writing this program for this class and I have a Start_Screen which allows the user to select their level of security (Administrator, Project Manager, Employee). Once they select which ever one it takes them to a User Login. I have three databases one for Administrator, one for PM and one for Employee. Each User Login navigates to the same Main Menu screen. I have two extra buttons that I want to add but I want them to be hidden when an employee logs in. Not real sure on how to code that and tell the buttons to know when to hide depending on who is logged in.

Again, new to this so if I need to provide anymore information just let me know.

Recommended Answers

All 3 Replies

I apologize if I post something wrong or something.

You don't have to apologize for posting something.

Well it's rather simple. I assume you have the logic to figure out whether the User that logged in is the employee, PM or Admin.

To Make the button invisible or hidden just do.

button1.Visible = false;
or 
button1.Visible = true;

You can also check the Visible status.

if (button1.Visible) // this by default means (button1.Visible == true) you can check for false as well.
{
    !button1.Visible; // if its visible make it invisible and vice versa 
}

I know how to make the button hidden and visible, What I am trying to do is to tell the button to hide when a specific person logs in.

So what I have is one database now with all the logins stored in it with a column called Security Level.

At login the user will type their ID Password and their Security Level(Administrator, Project Manager, Employee).

What I'm not exactly sure how to do is to pull that SecurityLvl_txt.Text over to the button's so they know what level is being accessed and to tell them when and when and when not to hide.

I know I need an if:

if(SecurityLvl = Administrator)
{
button.visible = true
}
else
{
button.visible = false
}

Just a little confused on how to pull the input over into the other form I guess.

Well, I assume you are checking the data with a database.

if so add in the Database UserType and make it of type int.

0 for Admin
1 for PM
2 for Employee

Now when user logs in check for user type and go ahead and do the different actions for different users.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.