Need help creating a shortcut key in vb.net using the CTRL key + function keys (F2)

  • Thread starter Thread starter Jim S
  • Start date Start date
J

Jim S

I am having a problem finding information regarding vb.net allowing
you to create shortcut keys for buttons using the CTRL key + function
buttons such as F1, F2 etc.. (Ex: Press CTRL+F1 to activate a click
event on a button). If anyone could help it would be sincerely
appreciated. Thank You!
 
Hello,

Jim S said:
I am having a problem finding information regarding vb.net allowing
you to create shortcut keys for buttons using the CTRL key + function
buttons such as F1, F2 etc.. (Ex: Press CTRL+F1 to activate a click
event on a button).

Create a hidden menu item and assign the shortcut to its 'Shortcut'
property. Put the code in the item's 'Click' event handler.
 
Jim S said:
I am having a problem finding information regarding vb.net
allowing you to create shortcut keys for buttons using the CTRL key +
function buttons such as F1, F2 etc.. (Ex: Press CTRL+F1 to activate
a click event on a button). If anyone could help it would be
sincerely appreciated. Thank You!

These accelerator keys can not be used with buttons. You can use "&Start" to
specify Alt+S as the shortcut for the button. What you can do is, either add
a menu to the form and select the accelarator like Ctrl+F1, or, set the
Form's keypreview property to True and catch the Form's KeyDown event (or
overwrite OnKeyDown).
 
Back
Top