I recently created a Windows Forms Application and some of the feedback from users was they would like to have some shortcuts for certain buttons. At first I just assumed this was easy enough but when I started looking into it I realised there didn’t appear to be any out of the box functionality that would do this.
As I’m sure most people do I turned to Google and found that there wasn’t a way to handle this with out custom code. At first I looked at using the KeyDown event on the form but this didn’t quite work as expected so I managed to find an another article which suggested overriding the ProcessCmdKey method. I tried this and like magic it works, see code below.
To be honest I would expect this functionality to work without the need to write custom code but there isn’t much to it so its not too bad.