user779444
user779444

Reputation: 1395

KeyPress event not responding to some keys (up, down, left, right, home...)

I have a windows form and an OnKeyPress function. I also have KeyPreview turned on.

The function responds to most keys except up, down, left, right, home, pgdown, end and so on...

It's like whenever I press those keys, it doesn't send them to the form, it just toggles between the buttons and the other controls.

Anyone experienced that and can help out?

Upvotes: 0

Views: 1680

Answers (1)

Alex Kovanev
Alex Kovanev

Reputation: 1888

From MSDN

The KeyPress event is not raised by noncharacter keys; however, the noncharacter keys do raise the KeyDown and KeyUp events.

Upvotes: 6

Related Questions