I put MenuStrip in Form1, and make the visible = False
I tried to find "ESC" at ShortCutKeys in MenuStrip Properties, but couldn't find it.
Is there other way to make the ESC shortcut key ?
It is possible that key is reserved for other uses, like escaping/cancel various things, and that using it would conflict such default system uses. But if you see no problem using it you can for example set the child forms KeyPreview property to True and handle the KeyUp event for the form. Here you can call the menu items click handler (menuitem.PerformClick). For that menu item you can set "ESC" as ShortcutKeyDisplayString even though no shortcut really has been set. KeyUp sample:
VB.NET:
Private Sub Form3_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyUp
If e.KeyCode = Keys.Escape Then
ExitToolStripMenuItem.PerformClick()
End If
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.