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.
17279
Well, you can hide a button by setting its Visible property to false. If the buttons are on the Main Menu screen, then - depending on who's logged in - I'd change their visiblity in the Form_Load eventhandler (assuming this is a Windows Forms application). I imagine you already have a way of making the login info available to this screen by passing these details via the constructor or otherwise?
412
Dear Justin, U forgot to tell if u're working on WinForm or WebPage(ASP)?? As vulpes said u can hide any control by button1.Visible = True (or False);

1 answers
depending on application type (winform/web).
pass the information via construct the form or ( delegate or event) and visibility is as was said before
public void OnLogin(string userLevel){
switch(userLevel){
case "admin":{
buttonN.visible = true;
buttonN.visible = true;
break;
}
case "Project Manager":{
buttonN.visible = false;
buttonN.visible = true;
break;
}
case "Employee":{
buttonN.visible = false;
buttonN.visible = false;
break;
}
}
}
answered one year ago by:
556