I know the event KeyPress
, but I want it to detect the key being in any part of the program, I could put this event in all the elements of the program, but I want to know if there is a more efficient way to do this
I know the event KeyPress
, but I want it to detect the key being in any part of the program, I could put this event in all the elements of the program, but I want to know if there is a more efficient way to do this
There is a method that could solve the problem
Form.ProcessCmdKey(Message, Keys) Method
leaving something like this
In this example it is detected if the enter key is pressed no matter where the focus is in the form
This is a method, not an event, so you will see that the
override
, but it allows you to capture the keyboard events of the entire form