There are two ways to automatically assign a keystroke to fire the 'click' event (misnamed, because it can be fired by non-click interactions):
- as lukeer states, if you put an & in the caption, that becomes the mnemonic letter which is underlined and becomes and Alt+X keystroke. E.g. button.Caption = "Ex&cellent"; => caption "Ex
cellent", hotkey Alt+C.
- if you have a menu which duplicates the available functionality, you can also explicitly set the MenuItem.Shortcut or
ToolStripMenuItem.ShortcutKeys[
^] property
You can also put a key handler on the form and fire the same method as the event handler calls, for example you can adapt
this article[
^].