Enable/Diseable Main menu
-
Having initially a diseabled main menu, how can i enable this menu when the user loggon? and diseable it when the user logout? other then using me.item1.enable=true me.item2.enable=true is there a way like : for each item in menu item.enable=true?? regards?
Regards Ramy
-
Having initially a diseabled main menu, how can i enable this menu when the user loggon? and diseable it when the user logout? other then using me.item1.enable=true me.item2.enable=true is there a way like : for each item in menu item.enable=true?? regards?
Regards Ramy
I assume you've added a MenuStrip to your form? You can disable the whole menu by setting it's enabled property to false and enable it by setting that property to true. You don't need to do on an item by item basis, unless I'm not understanding you correctly.
-
I assume you've added a MenuStrip to your form? You can disable the whole menu by setting it's enabled property to false and enable it by setting that property to true. You don't need to do on an item by item basis, unless I'm not understanding you correctly.
yes i have used a menustrip what i want when theu user Log enable the menu when he logout ,disbale the menu
Regards Ramy
-
yes i have used a menustrip what i want when theu user Log enable the menu when he logout ,disbale the menu
Regards Ramy
-
Then my previous advice should work. Just use MenuStrip1.Enabled = False and MenuStrip1.Enabled = True.
but what u suggest MenuStrip1.Enabled = False enable and diseable all the menu ,means enables the login menu also// so how the user will logon
Regards Ramy
-
but what u suggest MenuStrip1.Enabled = False enable and diseable all the menu ,means enables the login menu also// so how the user will logon
Regards Ramy
You stated you wanted to disable/enable the main menu. This to me meant the whole menu. To individually set items you can create a loop that iterates through each item and disable/enables it.
'Option #1 With MenuStrip1 'Disable each menu item For i As Integer = 0 To .Items.Count - 1 .Items(i).Enabled = False Next 'Enable the one(s) we want by index .Items(0).Enabled = True End With 'Option #2 'Disable each menu item For Each item As ToolStripItem In MenuStrip1.Items item.Enabled = False Next 'Enable by using it's name MenuStrip1.Items("FileToolStripMenuItem").Enabled = True
Enabling the items would just be a simple change