Noob dev
Noob dev

Reputation: 121

KeyPress at form level with controls

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

I can achieve this when there is no control on the form, but when i add something, like a button, the form loses the focus and i can't give it back, even with Me.Focus. The focus stays on the button.

Is there a way to do it ? If not, i would like to know why. Looks interesting.

Upvotes: 2

Views: 664

Answers (2)

Abhay shah
Abhay shah

Reputation: 76

Just set true to key preview property of your form it will work.

Upvotes: 1

Let's Enkindle
Let's Enkindle

Reputation: 53

You can do it by enabling KeyPrivew Property of your form.enter image description here

Upvotes: 0

Related Questions