By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,065 Members | 1,598 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,065 IT Pros & Developers. It's quick & easy.

How to detect Page Down/Page Up keys, etc.

P: n/a
foo
Hello,

I can trap alphanumeric keys wih this code but the event doesn't even fire
when a page down, page up, home, end is pressed. I've overloaded the
OnKeyPress event for the form. The event will fire on alphanumeric keys,
punctuation, etc. Why won't the event fire on Page Up/Page Down keys?
Protected Overrides Sub OnKeyPress(ByVal e As
System.Windows.Forms.KeyPressEventArgs)

Select Case Val(e.KeyChar())

Case Keys.PageDown ' Page Down

....

end function

Thanks,

Bill Nicholson

Cincinnati, OH, USA
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"foo" <fo*@foo.com> schrieb
I can trap alphanumeric keys wih this code but the event doesn't
even fire
when a page down, page up, home, end is pressed. I've overloaded
the OnKeyPress event for the form. The event will fire on
alphanumeric keys, punctuation, etc. Why won't the event fire on Page
Up/Page Down keys? Protected Overrides Sub OnKeyPress(ByVal e As
System.Windows.Forms.KeyPressEventArgs)

Select Case Val(e.KeyChar())

Case Keys.PageDown ' Page Down

...

end function


These keys don't create chars. Use OnKeyDown instead.
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2

P: n/a
In article <40***********************@nnrp.fuse.net>, fo*@foo.com
says...
I can trap alphanumeric keys wih this code but the event doesn't even fire
when a page down, page up, home, end is pressed. I've overloaded the
OnKeyPress event for the form. The event will fire on alphanumeric keys,
punctuation, etc. Why won't the event fire on Page Up/Page Down keys?


For the other keys, you need to override the OnKeyDown method.

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.