473,387 Members | 1,597 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,387 software developers and data experts.

Event for PgUp and PgDn on Form

Would like to use PgUp and PgDn from a Form event. Have successfully been
able to use the Enter key as an event unique event from a textbox using the
boxes KeyChar event and e.KeyChar = Microsoft.VisualBasic.ChrW(13) but
search as I may through Help I have not been able to find the keycodes for
PgUp or PgDn or confirm which key event is appropriate. Trial and error is
getting me no where<g>.

Ed
Nov 21 '05 #1
5 3014
Add a textBox & then add this code:

Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown

If e.KeyCode = Keys.PageDown Then
MessageBox.Show(e.KeyValue)
End If

If e.KeyCode = Keys.PageUp Then
MessageBox.Show(e.KeyValue)
End If

End Sub

PageUp = 33
PageDown = 34

Crouchie1998
BA (HONS) MCP MCSE
Nov 21 '05 #2
Crouchie, Works as advertised for a textbox but I was looking for a Form
event. I have several textboxes on my form and need the key event to do
some work that reloads all the boxes. If I place the example code under the
KeyDown event for the Form nothing happens. Suspect that is something to do
with the focus which remains in the textbox and the Form event is never
fired.

Ed
"Crouchie1998" <cr**********@spamcop.net> wrote in message
news:OF**************@TK2MSFTNGP10.phx.gbl...
Add a textBox & then add this code:

Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown

If e.KeyCode = Keys.PageDown Then
MessageBox.Show(e.KeyValue)
End If

If e.KeyCode = Keys.PageUp Then
MessageBox.Show(e.KeyValue)
End If

End Sub

PageUp = 33
PageDown = 34

Crouchie1998
BA (HONS) MCP MCSE

Nov 21 '05 #3
Ed,

"Ed Bitzer" <ed******@yahoo.com> schrieb:
Crouchie, Works as advertised for a textbox but I was looking for a Form
event. I have several textboxes on my form and need the key event to do
some work that reloads all the boxes. If I place the example code under
the KeyDown event for the Form nothing happens. Suspect that is something
to do with the focus which remains in the textbox and the Form event is
never fired.


Make sure the form's 'KeyPreview' property is set to 'True'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #4
Hefried,

That is what I was missing - and once you clued me in I admit I now see in
the Help files. I missed four times before. Still have not found the ident
of all the various special keys but trial with a message box will locate
their number, but would be nice to have their names (although this was to
obvious PgDn an PgUp - not even vbPgUp.

Ed"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:OP**************@TK2MSFTNGP10.phx.gbl...
Ed,

"Ed Bitzer" <ed******@yahoo.com> schrieb:
Crouchie, Works as advertised for a textbox but I was looking for a Form
event. I have several textboxes on my form and need the key event to do
some work that reloads all the boxes. If I place the example code under
the KeyDown event for the Form nothing happens. Suspect that is
something to do with the focus which remains in the textbox and the Form
event is never fired.


Make sure the form's 'KeyPreview' property is set to 'True'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #5
Hefried, Found the listing of key codes under key code constants - gives
the old VB code and the new Net codes. Of course can not explain why I did
not find before.

Ed

"Ed Bitzer" <ed******@yahoo.com> wrote in message
news:Oy**************@TK2MSFTNGP09.phx.gbl...
Hefried,

That is what I was missing - and once you clued me in I admit I now see in
the Help files. I missed four times before. Still have not found the
ident of all the various special keys but trial with a message box will
locate their number, but would be nice to have their names (although this
was to obvious PgDn an PgUp - not even vbPgUp.

Ed"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:OP**************@TK2MSFTNGP10.phx.gbl...
Ed,

"Ed Bitzer" <ed******@yahoo.com> schrieb:
Crouchie, Works as advertised for a textbox but I was looking for a
Form event. I have several textboxes on my form and need the key event
to do some work that reloads all the boxes. If I place the example code
under the KeyDown event for the Form nothing happens. Suspect that is
something to do with the focus which remains in the textbox and the Form
event is never fired.


Make sure the form's 'KeyPreview' property is set to 'True'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>


Nov 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: lestersal | last post by:
Hi, We have a Java app at work (running on Windows 2000) and I'm trying to use SendKeys in Microsoft Access VBA to get it to do a Ctrl-PgDn. The Java app is respoding to a single key. For...
13
by: Simon Wigzell | last post by:
Can I trap when the scroll is ended? This is what I want - the calculator disapears when the site visitor starts scrolling the main page. I'm doing that with an "onScroll()" function. I'm bringing...
3
by: Vikram Bhatia | last post by:
1. Is there an event to capture scrolling using mouse wheel in Netscape 6.x? 2. When arrow keys are used to scroll a page in Netscape 6.x, the scrolling offsets obtained using...
4
by: phil_gg04 | last post by:
Dear Javascript Experts, I'm currently implementing Anyterm, a terminal emulator on a web page. It consists of an Apache module, some XmlHTTP and a bit of Javascript. The idea is to give you...
8
by: William Ortenberg | last post by:
I'm trying to capture when a user presses a particular key (escape), so I'm coding in the KeyPress event. Yet the code seems be bypassed (breakpoint is never encountered). Should I be coding in a...
0
by: Filips Benoit | last post by:
Dear All, A2K Win2K MasterForm having 6 subforms total = 3 pages. If cursor stays in master PGUP and PGDN works OK but if the cursor is in a subform the PGUP and PGDN only affects the...
9
by: Miky | last post by:
Hi, I need to send Ctrl-PgUp (or Ctrl-PgDown) to the active application but when I use SendKeys.Send("^{PGUP}"), the program understands it as just PageUp. How may I solve it? Thanks in...
3
by: Matuag | last post by:
Hi All, How Can I disable PgUp and PgDown keys while in the Form view? Is there is any way to do this using GUI (no scripts) in Access 07? Matuag.
4
by: rosta | last post by:
Hi, I found following problem in FF 3.0.9 (it looks it is FF problem only). See few lines of code below: <html> <head> <title>TEST</title> <script type="text/javascript"> ...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.