How to disable shortcut keys

trialer

Well-known member
Joined
Oct 4, 2010
Messages
64
Programming Experience
1-3
in my form, i have toolstrip and some of them have shortcut keys. how do i disable them on load. i cant find the exact code.

VB.NET:
 Private Sub MainMenu_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
      login.ShortcutKeys.enabled =  false
    End Sub
 
That request doesn't seem to make sense. It sounds like you're trying to disable something that you added in the first place. Can you provide a more complete explanation of what you've done and what you're trying to do?
 
well anyway thank you.. i had make a condition in my program that when somebody login, shortcut menus are enabled and when it logouts the shortcuty menu is set to disable so that when they press the shortcut menu it won't process any command..
 
It's still not clear what exactly you're talking about. You seem to forget that we have no prior knowledge of your project so you have to provide us with ALL the relevant information. What shortcut menu are you talking about? Do you mean a ContextMenuStrip in your application? Do you mean items that you've added to the Windows Explorer right-click menu? Do you mean something else? Please take the time and make the effort to provide a FULL and CLEAR description of the problem. It's no fun trying to guess what people want. Help us to help you.
 
i think i found the answer to my problem..

VB.NET:
if user = "" then 
SaveToolStripMenuItem.ShortcutKeys = Nothing[COLOR=Blue][/COLOR]
Else
SaveToolStripMenuItem.ShortcutKeys = Keys.Ctrl + Keys.S[COLOR=Blue][/COLOR]
 
Toggling True/False values sounds like a lot better idea than spending time hardcoding lots of Keys values. You can use the Enabled property or the Available property for each menu item.
 
Back
Top