Hello,
I'm developing a dialog based C# 2.0 application. My dialog has some buttons on it. I need to handle some "keyPress" events on my dialog such that each time for example key 1 was pressed, a certain action is taken. But, when I defined the event handler I found it not wokring. The problem was that the focus is on buttons not on the dialog and the handler belongs to my dialog.
To solve the problem I used:
But didn't work!
How can keep the focus always on my dialog such that I can handle the key event. Or is there any other solution that lets me use the key handler?
Thx
I'm developing a dialog based C# 2.0 application. My dialog has some buttons on it. I need to handle some "keyPress" events on my dialog such that each time for example key 1 was pressed, a certain action is taken. But, when I defined the event handler I found it not wokring. The problem was that the focus is on buttons not on the dialog and the handler belongs to my dialog.
To solve the problem I used:
Code:
this.Focus();
But didn't work!
How can keep the focus always on my dialog such that I can handle the key event. Or is there any other solution that lets me use the key handler?
Thx