For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic > August 2005 > KeyCode Constants!









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author KeyCode Constants!
Arpan

2005-08-28, 3:55 am

The members of the KeyCode Constants listed in the Object Browser
doesn't list the KeyCode Constant of the 'Enter' key as well as the
KeyCode Constant of the Numeric Pad 'Enter' key! What are the KeyCode
Constants of these 2 keys?

Thanks,

Arpan

mscir

2005-08-28, 3:55 am

Arpan wrote:
> The members of the KeyCode Constants listed in the Object Browser
> doesn't list the KeyCode Constant of the 'Enter' key as well as the
> KeyCode Constant of the Numeric Pad 'Enter' key! What are the KeyCode
> Constants of these 2 keys?
> Thanks,
> Arpan


Google & Dogpile are your friends:
http://www.google.com/search?hl=en&...G=Google+Search
http://www.dogpile.com/info.dogpl/s...asic%2Bkeycodes

http://www.gh-gold.co.uk/keycodes.php

vbKeyReturn 0xD ENTER key
vbKeySeparator 0x6C ENTER key

Mike

Rick Rothstein [MVP - Visual Basic]

2005-08-28, 7:55 am

> The members of the KeyCode Constants listed in the Object Browser
> doesn't list the KeyCode Constant of the 'Enter' key as well as the
> KeyCode Constant of the Numeric Pad 'Enter' key! What are the KeyCode
> Constants of these 2 keys?


All of the Keycode Constants are listed in VB's help files. Type "key
code constants" (without the quote marks) in the search field of the
Index tab to see them. The constants you want are vbKeyReturn (13) for
the regular Enter key and vbKeySeparator (108) for the numeric keypad's
Enter key. Keep in mind that for the keypad key values to be "active",
the NumLock key must be off; otherwise the keypad keys will generate the
same codes as for the regular keyboard.

Rick


Rick Rothstein [MVP - Visual Basic]

2005-08-28, 7:55 am

> > The members of the KeyCode Constants listed in the Object Browser
KeyCode[color=darkred]
>
> All of the Keycode Constants are listed in VB's help files. Type "key
> code constants" (without the quote marks) in the search field of the
> Index tab to see them. The constants you want are vbKeyReturn (13) for
> the regular Enter key and vbKeySeparator (108) for the numeric

keypad's
> Enter key. Keep in mind that for the keypad key values to be "active",
> the NumLock key must be off; otherwise the keypad keys will generate

the
> same codes as for the regular keyboard.


Forget the second part of what I said above (so much for answering
questions from the top of my head.<g> ) Both the regular keyboard and the
numeric keypad always return a value of 13 (vbKeyReturn) for their Enter
keys no matter what the setting of the NumLock key is. It appears that
vbKeySeparator (108) is never returned for the numeric keypad. As for
the NumLock's effect... the listed keycodes in the article I cited for
the keypad numbers are as shown when the NumLock is on... if the NumLock
is off however, the returned keycodes for the numeric keys are those
codes of the alternately shown labels (Home, PgUp, arrows, etc.) that
the main keyboard generates. By the way, you can test this all out by
putting

Debug.Print KeyCode

in the KeyDown or KeyUp event of the Form (or a control having these
events), running the project and watching what numbers get printed out
in response to your keystrokes.

Rick


Ted

2005-08-28, 7:55 am

vbKeySeparator and vbKeyReturn

Open VB help and look for Keycode constants
should have the whole list.



"Arpan" <arpan_de@hotmail.com> wrote in message
news:1125214049.520932.9260@g14g2000cwa.googlegroups.com...
> The members of the KeyCode Constants listed in the Object Browser
> doesn't list the KeyCode Constant of the 'Enter' key as well as the
> KeyCode Constant of the Numeric Pad 'Enter' key! What are the KeyCode
> Constants of these 2 keys?
>
> Thanks,
>
> Arpan
>



J French

2005-08-28, 7:55 am

On 28 Aug 2005 00:27:29 -0700, "Arpan" <arpan_de@hotmail.com> wrote:

>The members of the KeyCode Constants listed in the Object Browser
>doesn't list the KeyCode Constant of the 'Enter' key as well as the
>KeyCode Constant of the Numeric Pad 'Enter' key! What are the KeyCode
>Constants of these 2 keys?


Enter is: vbKeyReturn

I'm not sure about the Number Pad enter key

Well, well it is: vbKeySeparator

Having said that I can't detect it as that in a Form's KeyDown event
- which is probably fortunate


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com