473,388 Members | 1,988 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

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

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
2 3698
"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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Anushya | last post by:
Hi I am using Listview and inherited listview control overriding WndProc & PreProcessMessage in ListView. I need this to customize listview to display only the page the user scrolls to. Since i...
3
by: Tegdeep | last post by:
Here's what I want to do: I have a hash table which contains data associated to different keys. The Hash keys are represented by a single character from the keyboard: 0-9, a-z, A-Z, and the...
3
by: Charlie | last post by:
In the top portion of the DateTimePicker, where the value of the date is displayed, how can I detect whether the month or day or year is currently focused, or, if ShowCheckBox = True, whether the...
0
by: Martijn Mulder | last post by:
/* I override IsInputKey() to direct the Arrow Keys (Cursor Keys) to my custom System.Windows.Forms.Control. But, holding down the Shift-Key prevents the Arrow Keys from coming through. How can...
7
by: warbornster | last post by:
Hi, I want to detect wether the arrowkeys are pressed down or not. I would be happy if it would be as simple like "if (keys.Up == true) something()" but there seems to be harder than this. I would...
9
by: Anish G | last post by:
Hi, I have a visual basic application which needs to detect keyboard events. I want to it to detect all the arrow keys (Left, Right, Up, Down) and these should be detected at form level. I have...
0
by: Andrus | last post by:
I placed DateTimePicker to Winforms DataGridView using sample code from MSDN. When dropdown calendar is not opened, up and down arrow keys must move to previous/next row in grid. So I modified...
4
by: raylopez99 | last post by:
Compound question: first, and this is not easy, if there's a way to detect multiple simultaneous key presses in C# let me know (in the below code, keys c and d being pressed simultaneously or...
5
by: JamesX | last post by:
I am having trouble detecting if "down" or "up" key is pressed within a textbox. Evidently those keys do not fire the "KeyPressed" event. Does anyone know how to detect when they are pressed?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.