window form application
-
I make three form one admin and second user and mainform if admin login then my main form all the menu item is enable but when user login then also all menustrip item button is enable how to disable this menu item. Please help to solve this problem.
-
I make three form one admin and second user and mainform if admin login then my main form all the menu item is enable but when user login then also all menustrip item button is enable how to disable this menu item. Please help to solve this problem.
-
I make three form one admin and second user and mainform if admin login then my main form all the menu item is enable but when user login then also all menustrip item button is enable how to disable this menu item. Please help to solve this problem.
ANKIT KUMAR SINHA wrote:
if admin login then my main form all the menu item is enable but when user login then also all menustrip item button is enable how to disable this menu item
Instead of disabling the menu-item, I'd recommend not creating it in the first place.
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]
-
I make three form one admin and second user and mainform if admin login then my main form all the menu item is enable but when user login then also all menustrip item button is enable how to disable this menu item. Please help to solve this problem.
Try creating a variable in the login form, when any of them logs in assign a value to that variable. Note: the value assigned should be different depending on who logged in. E.g (variable_name = 1..when admin logs in, variable_name = 2..when user logs in ). On the load event of the main form use an if statement to check the value of that variable. Depending on the value of the variable disable the menustrip item using the its name. Example when a normal user logs in If(variable_name=1) { Menustripitem_name.enable=false; } Remember to declare the variables for validation as static variables in the login form so as to access it in the mainform. Hope that works
-
Try creating a variable in the login form, when any of them logs in assign a value to that variable. Note: the value assigned should be different depending on who logged in. E.g (variable_name = 1..when admin logs in, variable_name = 2..when user logs in ). On the load event of the main form use an if statement to check the value of that variable. Depending on the value of the variable disable the menustrip item using the its name. Example when a normal user logs in If(variable_name=1) { Menustripitem_name.enable=false; } Remember to declare the variables for validation as static variables in the login form so as to access it in the mainform. Hope that works
Thanks. I also solve this problem but my procedure is different first i MDI Parent form menustrip itme property change the modifier it declared public and then i access this menu strip in other form like login form. step:1 menustripitem property = public step:2 creating an object the login form step:3 object.menustripitem.Enabled = false; it working properly
-
Thanks. I also solve this problem but my procedure is different first i MDI Parent form menustrip itme property change the modifier it declared public and then i access this menu strip in other form like login form. step:1 menustripitem property = public step:2 creating an object the login form step:3 object.menustripitem.Enabled = false; it working properly
you also realise that you can merge menu's from the child forms into the parent container? Google : MDI Parent form merge menustrip[^]
Every day, thousands of innocent plants are killed by vegetarians. Help end the violence EAT BACON
-
I make three form one admin and second user and mainform if admin login then my main form all the menu item is enable but when user login then also all menustrip item button is enable how to disable this menu item. Please help to solve this problem.
check it userwise if(user =="admin"){ menu.IsEnable=true; } else {menu.IsEnable=false;} something like this
Sankarsan Parida
-
I make three form one admin and second user and mainform if admin login then my main form all the menu item is enable but when user login then also all menustrip item button is enable how to disable this menu item. Please help to solve this problem.
Try making a Boolean variable. On login, the app must determine if the logged in user is admin or not. Then, set the appropriate values.
On login:
If user is admin: adminbool = true
else
adminbool = falseOn form_load
If(adminbool=false)
{
Menustripitem_name.enable=false;
}else
{
Menustripitem_name.enable=true;
}You get the idea, right?