Results 1 to 5 of 5

Thread: keycode in keydown: always capitalized?

  1. #1

    Thread Starter
    Addicted Member c@lle's Avatar
    Join Date
    Oct 1999
    Location
    Belgium
    Posts
    179
    Hello,
    if i translate the keycode from the keydown event, using:
    myLetter= chr(keycode)

    then I get always a capitalized letter.

    How can i translate this letter to a normal one?


    eg. the user presses 'b', but if i use 'debug.print chr(keycode)' i get a 'B'


  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    This is because the KeyCode is connected to the key on the keyboard itself. The user pressed the "B" button. If you want to check if it's actually a lower case b then you have to check the Shift argument to see if the shift key is down and you also have to make an API call to check the Caps Lock status.

    If you use the KeyPress event instead of the KeyDown you get the KeyAscii instead of the KeyValue.

  3. #3

    Thread Starter
    Addicted Member c@lle's Avatar
    Join Date
    Oct 1999
    Location
    Belgium
    Posts
    179
    I found it myself:

    if I use the following, it is ok

    LCase(Chr(keycode))


    [Edited by c@lle on 09-13-2000 at 04:24 AM]

  4. #4
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Yes but that will always return the lower case of the character. Even if do you type a CAPITAL character.

  5. #5

    Thread Starter
    Addicted Member c@lle's Avatar
    Join Date
    Oct 1999
    Location
    Belgium
    Posts
    179
    that was exactly what I needed. I know that I have to check the SHIFT state for knowing that it IS a capital or not.

    Thanks anyway;
    calle

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width