Connecting Tech Pros Worldwide Help | Site Map

Recognizing keystrokes?

  #1  
Old March 10th, 2006, 09:25 PM
Rico
Guest
 
Posts: n/a
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

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

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

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

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

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]


Closed Thread