CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: KeyAscii

  1. #1
    Join Date
    Dec 2005
    Posts
    7

    KeyAscii

    Hello.If somebody know's the KeyAscii for PageUp and PageDown please mail me to: [email protected], thanks.

  2. #2
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: KeyAscii

    Quote Originally Posted by mainar
    Hello.If somebody know's the KeyAscii for PageUp and PageDown please mail me to.
    PageUp- 33
    Pagedown - 34
    Remember you cannot trap these keys in KeyPress Event. You will either have to use KeyUp or KeyDown Event.

    And don't put your emailId out here.

  3. #3
    Join Date
    Oct 2005
    Location
    England
    Posts
    803

    Re: KeyAscii

    If you want to find any keyAscii value just place in the keypress event on a form or object the following code.

    Code:
    Text1.Text = KeyAscii

    Then everytime you press a key the textbox will display the value of that key.

    Rich

  4. #4
    Join Date
    Nov 2005
    Location
    Omaha, Nebraska, USA
    Posts
    696

    Re: KeyAscii

    Quote Originally Posted by Rich2189
    If you want to find any keyAscii value just place in the keypress event on a form or object the following code.
    Code:
    Text1.Text = KeyAscii
    Then everytime you press a key the textbox will display the value of that key.

    Rich
    That wouldn't work, since Page Up and Page Down do not have ASCII values.

    In VB, they do have key codes (designated as 33 for vbKeyPageUp and 34 for vbKeyPageDown), so you can check for them in KeyUp and KeyDown events, but not in KeyPress events.

    You can also find other keys (like Shift, Caps Lock, Home, End, Insert, Delete, all the Function keys, and so on) only through KeyUp and KeyDown, since they don't have ASCII values.

  5. #5
    Join Date
    Oct 2005
    Location
    England
    Posts
    803

    Re: KeyAscii

    i feel like a dunce now, im doing KeyAscii in college at the moment, of course it doesnt have a value, thanks chaos, now i know how to get the arrow keys to work

    Rich

  6. #6
    Join Date
    Dec 2002
    Location
    London, UK
    Posts
    1,569

    Re: KeyAscii

    Another great way to get ascii key values... use the VB constants
    i.e.
    vbKeyPageDown, vbKeyPageUp, vbKeyF1 etc etc etc
    Mike

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

Featured