Click here to Skip to main content
15,886,788 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
working on a window apps in Dot net for Rtail inventory. need to provide permission in login time so that person of SALES department cannot access Transaction Forms.
I hv an MDI apps with Menu.
Posted

1 solution

C#
//Add a global class in ur project

static class GlobalClass
    {
        private static string _username = "";


        public static string username
        {
            get { return _username; }
            set { username = value; }
        }


//create a  LoginForm and in login button add
//Accoring to ur user type

GlobalClass.username = "Admin";


//in Mdi Form Load check this for hiding menu items

if (GlobalClass.username != "Admin")
            {
                buttonItemDep.Visible =true;
                buttonItemclass.Visible = true;
                buttonItemfac.Visible = true;
    }
else
    {  buttonItemDep.Visible = false;
                buttonItemclass.Visible = false;
                buttonItemfac.Visible = false; }
 
Share this answer
 
v2

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