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

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!
 
H

Herfried K. Wagner [MVP]

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.
 
A

Armin Zingler

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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top