Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Techs,

I am beginner in C# and ASP.Net. I am using One Login Forms, MDI form, FormA, FormB,FormC.., if 1st I am Execute Login form, There are Two Text boxes as txtusername, txtpassword and One Combo box for type of user like(Admin, A,B,C). Now, I enter user name and password in login form then show the MDI form. In MDI form I am using Menustrip for Access the FormA,FormB, and Formc.

If I am login as Admin, I want to access all forms like frmA,frmB,FrmC. other than, if I am login as A, I want access FormA (frmA) only as its too all other users. How to do this. Please help me to solve this. Database(SQL SERVER2005).

Thanks & Regards
Sreenivashan
Posted
Updated 4-Jun-14 23:54pm
v2

1 solution

All you have to do is add a check in the code where you are opening the form to ensure the user is permitted.

There are two places you can do this: When you call Show to display the form, or in the Form.Load event (all you have to do is check, then if the user is not permitted, call the Close method).
The former is "safer" but the later is easier to ensure that access is permitted - you don't need to remember to check everywhere you open the form.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900