Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old March 10th, 2006, 09:25 PM
Rico
Guest
 
Posts: n/a
Default 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!


  #2  
Old March 10th, 2006, 09:35 PM
Hansen
Guest
 
Posts: n/a
Default Re: Recognizing keystrokes?

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

  #3  
Old March 11th, 2006, 04:05 PM
Rico
Guest
 
Posts: n/a
Default Re: Recognizing keystrokes?

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" <helgardh@hotmail.com> wrote in message
news:1142025744.024069.41030@z34g2000cwc.googlegro ups.com...[color=blue]
> 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
>[/color]


  #4  
Old March 11th, 2006, 05:05 PM
RoyVidar
Guest
 
Posts: n/a
Default Re: Recognizing keystrokes?

Rico wrote in message <DrCQf.26216$Ui.6883@edtnps84> :[color=blue]
> 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" <helgardh@hotmail.com> wrote in message
> news:1142025744.024069.41030@z34g2000cwc.googlegro ups.com...[color=green]
>> 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
>>[/color][/color]

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

--
Roy-Vidar


  #5  
Old March 11th, 2006, 05:55 PM
Randy Harris
Guest
 
Posts: n/a
Default Re: Recognizing keystrokes?

Rico wrote:[color=blue]
> 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" <helgardh@hotmail.com> wrote in message
> news:1142025744.024069.41030@z34g2000cwc.googlegro ups.com...[color=green]
>> 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
>>[/color][/color]


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.
  #6  
Old March 11th, 2006, 07:15 PM
Rico
Guest
 
Posts: n/a
Default Re: Recognizing keystrokes?

Excellent! Thanks guys!

"Randy Harris" <please@send.no.spam> wrote in message
news:aYDQf.58009$dW3.4099@newssvr21.news.prodigy.c om...[color=blue]
> Rico wrote:[color=green]
>> 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" <helgardh@hotmail.com> wrote in message
>> news:1142025744.024069.41030@z34g2000cwc.googlegro ups.com...[color=darkred]
>>> 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
>>>[/color][/color]
>
>
> 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.[/color]


 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles