KeyPress at the form level with controls

I am wondering if it is possible to handle a KeyPress event at the form level when there are controls in the form .

I can achieve this when there is no control over the form, but when I add something like a button, the form loses focus and I can’t get it back, even with Me.Focus . Focus remains on the button.

Is there any way to do this? If not, I would like to know why. It looks interesting.

+2
source share
2 answers

You can do this by enabling the KeyPrivew property of your form. enter image description here

+1
source

Just set true for the key preview property in your form, it will work.

+1
source

All Articles