Windows Application and shortcut key are synonyms. People prefer to use shortcut keys for faster activity. Assume you are in a text box and you want to hit F5 to reload the form. You do not want to move your mouse cursor. So what you will be doing is that you will be adding “Key Down” event to the text box. But if you are in a different text box or in a button that will not work. So you will add “Key Down” event to your form.
But you need to enable a property to work it properly and that’s the trick.
private void Form1_KeyDown(object sender, KeyEventArgs e)
if (e.KeyCode == Keys.F5)
But golden trick is, in the property window of the Form make the following changes
KeyPreview = True
PingBack from http://blog.a-foton.ru/2008/07/windows-forms-%e2%80%93-enable-shortcut-key-all-over-the-form/
Great piece of information. It works
thanks for the trick
Thank u, it is the information i was searching for
i tried d same code
i also set KeyPreview = True
i pressed F5 when d form loaded
but it dint work
thanks in advance
how to put two combition like (ALT+ S)
Cool shortcuts, very useful. Thanks a bunch!!! I found a few move shortcuts here: www.usingcomputers.co.uk/.../useful-windows-shortcuts.php its worth taking a look at combined with this article. Thanks, keep up the good posts!
Hmm. good but how to do it with mulitple keys....?
useful code.it works
Thank you very much. Your post helped me alot. It works very well.