When the user presses SHIFT+UP
key, I want my form to respond by calling up a message box.
How to do this in Windows Form?
When the user presses SHIFT+UP
key, I want my form to respond by calling up a message box.
How to do this in Windows Form?
Handle the KeyDown event and have something like:
if (e.modifiers == Keys.Shift && e.Keycode == Keys.Up)
{
MessageBox.Show("My message");
}
The event handler has to be on the main form and you need to set the KeyPreview
property to true
. This can be done in design mode from the properties dialog.