Results 1 to 6 of 6

Thread: [RESOLVED] ASCII Table needed

  1. #1

    Thread Starter
    Addicted Member ajames's Avatar
    Join Date
    Mar 2005
    Location
    Wales, UK
    Posts
    178

    Resolved [RESOLVED] ASCII Table needed

    If anyone has an ASCII table (or a link) for keypresses for use in VB6 I would much appreciate it if you could post a link/copy.

    Thanks in advance

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: ASCII Table needed

    If you type "vbKey" and then press Ctrl+Space, you get a dropdown list of all the constants.
    Code:
    vbKeyLButton    Left Mouse Button
    vbKeyRButton    Right Mouse Button
    vnKeyCancel     Cancel Key
    vbKeyMButton    Middle Mouse button
    vbKeyBack       Back Space Key
    vbKeyTab        Tab Key
    vbKeyClear      Clear Key
    vbKeyReturn     Enter Key
    vbKeyShift      Shift Key
    vbKeyControl    Ctrl Key
    vbKeyMenu       Menu Key
    vbKeyPause      Pause Key
    vbKeyCapital    Caps Lock Key
    vbKeyEscape     Escape Key
    vbKeySpace      Spacebar Key
    vbKeyPageUp     Page Up Key
    vbKeyPageDown   Page Down Key
    vbKeyEnd        End Key
    vbKeyHome       Home Key
    vbKeyLeft       Left Arrow Key
    vbKeyUp         Up Arrow Key
    vbKeyRight      Right Arrow Key
    vbKeyDown       Down Arrow Key
    vbKeySelect     Select Key
    vbKeyPrint      Print Screen Key
    vbKeyExecute    Execute Key
    vbKeySnapshot   Snapshot Key
    vbKeyInsert     Insert Key
    vbKeyDelete     Delete Key
    vbKeyHelp       Help Key
    vbKeyNumlock    Delete Key
    
    vbKeyA through vbKeyZ are the key code constants for the alphabet
    vbKey0 through vbKey9 are the key code constants for numbers
    vbKeyF1 through vbKeyF16 are the key code constants for the function keys
    vbKeyNumpad0 through vbKeyNumpad9 are the key code constants for the numeric key pad
    
    Math signs are:
    vbKeyMultiply      -  Multiplication Sign (*)
    vbKeyAdd             - Addition Sign (+)
    vbKeySubtract     - Minus Sign (-)
    vbKeyDecimal    - Decimal Point (.)
    vbKeyDivide        - Division sign (/)
    vbKeySeparator  - Enter (keypad) sign

  3. #3

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: ASCII Table needed

    You can also do this
    VB Code:
    1. Private Sub Command1_Click()
    2. Dim i As Long
    3.     For i = 0 To 255
    4.         List1.AddItem "Chr(" & i & ") = " & Chr(i)
    5.     Next
    6. End Sub
    If you wanted to save them, I would replace the Listbox with a text file.
    VB Code:
    1. Private Sub Command1_Click()
    2. Dim i As Long
    3. Open "c:\Ascii.txt" For Append As #1
    4.     For i = 0 To 255
    5.         Print #1, Chr(" & i & ") = " & Chr(i)
    6.     Next
    7. Close #1
    8. End Sub

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: ASCII Table needed

    Quote Originally Posted by ajames
    Does this do capitals, lowercase, or can you specify?
    Also, Are there codes for things such as ~ and }?
    Those will all be displayed if you run the ASCII code code that I posted.

    You will see that Chr(65) through Chr(89) is Capital A through Z
    Chr(97) through Chr(122) is Lower Case a through z
    Chr(125) = }
    Chr(126) = ~

  6. #6
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: ASCII Table needed

    No it doesn't do anything automatically for you - you need to send the SHIFT key...
    If you developing virtual keyboard you must know if "SHIFT" was pressed so you will send appropriate character - but generally all you need to know which button was pressed in your app - assign characters directly for each button respectively just like you see it on your physical keyboard. So, if "your shift" is pressed assign UCase and LCase otherwise.

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