473,503 Members | 2,166 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Recognizing keystrokes?

Hello,

Is there any way I can tell which key was pressed in VB Code using the
OnKeyPress event? I'd like to know if the user is pressing the up, down,
left or right arrow.

Thanks!
Mar 10 '06 #1
5 1913
Hi

Your answer is in this post:
http://groups.google.co.za/group/com...40f36f9d16efba

Sorry about the line breaks. You can also search this group by typing
"Cursor Value" next to the Search This Group button

Mar 10 '06 #2
Thanks Hansen, The "Cursor Value" isn't occuring when I hit the up, down
left or right keys. If I hit the letter / number keys, the keypress is
registering, but nothing when I hit the keys I want. Any ideas?
"Hansen" <he******@hotmail.com> wrote in message
news:11*********************@z34g2000cwc.googlegro ups.com...
Hi

Your answer is in this post:
http://groups.google.co.za/group/com...40f36f9d16efba

Sorry about the line breaks. You can also search this group by typing
"Cursor Value" next to the Search This Group button

Mar 11 '06 #3
Rico wrote in message <DrCQf.26216$Ui.6883@edtnps84> :
Thanks Hansen, The "Cursor Value" isn't occuring when I hit the up, down
left or right keys. If I hit the letter / number keys, the keypress is
registering, but nothing when I hit the keys I want. Any ideas?
"Hansen" <he******@hotmail.com> wrote in message
news:11*********************@z34g2000cwc.googlegro ups.com...
Hi

Your answer is in this post:
http://groups.google.co.za/group/com...40f36f9d16efba

Sorry about the line breaks. You can also search this group by typing
"Cursor Value" next to the Search This Group button


Try using the KeyDown (not KeyPressed) event, and test the KeyCode

--
Roy-Vidar
Mar 11 '06 #4
Rico wrote:
Thanks Hansen, The "Cursor Value" isn't occuring when I hit the up, down
left or right keys. If I hit the letter / number keys, the keypress is
registering, but nothing when I hit the keys I want. Any ideas?
"Hansen" <he******@hotmail.com> wrote in message
news:11*********************@z34g2000cwc.googlegro ups.com...
Hi

Your answer is in this post:
http://groups.google.co.za/group/com...40f36f9d16efba

Sorry about the line breaks. You can also search this group by typing
"Cursor Value" next to the Search This Group button

As Roy-Vidar indicated you need to use the KeyDown event to trap arrow
and function keys. KeyPress only shows ASCII values.

In KeyDown, the value KeyCode will contain:

Up-Arrow: 38
Down-Arrow: 40
Left-Arrow: 37
Right-Arrow: 39

HTH
--
Randy Harris
tech at promail dot com
I'm pretty sure I know everything that I can remember.
Mar 11 '06 #5
Excellent! Thanks guys!

"Randy Harris" <pl****@send.no.spam> wrote in message
news:aY******************@newssvr21.news.prodigy.c om...
Rico wrote:
Thanks Hansen, The "Cursor Value" isn't occuring when I hit the up, down
left or right keys. If I hit the letter / number keys, the keypress is
registering, but nothing when I hit the keys I want. Any ideas?
"Hansen" <he******@hotmail.com> wrote in message
news:11*********************@z34g2000cwc.googlegro ups.com...
Hi

Your answer is in this post:
http://groups.google.co.za/group/com...40f36f9d16efba

Sorry about the line breaks. You can also search this group by typing
"Cursor Value" next to the Search This Group button

As Roy-Vidar indicated you need to use the KeyDown event to trap arrow and
function keys. KeyPress only shows ASCII values.

In KeyDown, the value KeyCode will contain:

Up-Arrow: 38
Down-Arrow: 40
Left-Arrow: 37
Right-Arrow: 39

HTH
--
Randy Harris
tech at promail dot com
I'm pretty sure I know everything that I can remember.

Mar 11 '06 #6

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

Similar topics

2
4968
by: Olli Piepponen | last post by:
Hi, I'm having a little problem catching keystrokes under Windows. I did a little research and found that with mscvrt.getch() one can cath a single key that is pressed. However this doesn't work...
2
3184
by: Steven Raasch | last post by:
I would really like to send keystrokes to a QT application from another program. The ideal situation would allow me to use STDIN, but I'm guessing that this is not going to happen. Keeping in...
3
8945
by: Wayne | last post by:
I have a console application (ssh2.exe) that requires keystrokes to be sent to it after activating. I have worked that it needs to be started in it own thread, but capturing the process and...
5
2720
by: Lucas Tam | last post by:
Hi all, Has anyone done this before? Send client side keystrokes to an application from a webpapge? This maybe more of a Javascript question. In short, I have an application on the client's...
2
1628
by: zak | last post by:
I have some testing to do and I need to put a whole set of data in I want to Record and replay in a loop keystrokes. An idea
2
10154
by: Tim Diggle | last post by:
I'm trying to enter data into a database application running under Citrix ICA Client. I'm doing it from a VBA macro running under Microsoft Excel 2000 (although it may need to be backwardly...
3
5032
by: Gunnar Syren | last post by:
I'm trying to implement a macro feature in my application by recording and playing back keystrokes. At first I thought it would be enough to catch KeyDown in my main form, but I soon realized that...
1
3729
by: zanthor | last post by:
Ok... so call me crazy, but I have an idea and I'm looking for where to start... I want to write an application that catches keystrokes and then either redirects them to the in focus window or...
1
1453
by: thulaseeram | last post by:
hi, i am using the following code for uploading <div id="iframe" name="iframe" style="width:850px; height:120px;"> <iframe name="attach_frame" id="attach_frame"...
4
2290
by: Vighneswar | last post by:
Hi All Can anybody please suggest me in this regard that I need to capture the keystrokes on all the word processors (Ms Word, Excel .. Etc), text editors (Notepad .. Etc) and suggest nearer...
0
7205
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
7287
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,...
1
7011
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...
0
7468
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5596
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5023
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
1521
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
747
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
401
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.