I understand the use of the ampersand ("&") combined with a button's UseMnemonic property will enable the keystroke combination of Alt+ whatever letter trails the "&" in the button's text property (e.g., if ButtonAdd.Text = "&Add New..." pressing Alt+A will trigger). But what to do if your users want a keystroke combination that doesn't include Alt? Or a keystroke combination that doesn't include any letter in the button's text property?
I faced this situation, and did what I always do: I queried Uncle Google. After a few false trails, I eventually stumbled across a MSDN article discussing how to bind keystrokes in a datagrid. Cool. But after reading it, I thought it was overkill for what I wanted to do.
Then I thought about how easy it is to bind a keystroke to a menu item through the menu item's ShortcutKey property. And how easy it is to make a menu and/or individual items invisible with the Visible property... Voila!
The KISS (Keep It Simple Steve) solution was to create a new, hidden menu that only contains items for actions I wanted to have a button triggered by a keystroke (e.g., HiddenAdd, HiddenEdit, etc.). I then bound the menu actions to keystrokes through each menu item's ShortcutKey property.
Then, I created the necessary events in the code behind the form to make both events (menu item click event triggered by the keystroke combination and the button click event) point to a common Sub (or function) to perform whatever actions are needed.
Call doAddButtonClick()
End Sub
Sub doAddButtonClick()
'Put whatever code needs to occur here. It's now called from button click and whatever keyboard shortcut you assigned to the hidden menu item.
End Sub
Private Sub HiddenMenuAdd_Click(sender As System.Object, e As System.EventArgs) Handles HiddenMenuAdd.Click
Call doAddButtonClick()
End Sub