Results 1 to 5 of 5

Thread: Ascii Values of numbers

Hybrid View

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2000
    Location
    UK
    Posts
    36

    Question

    Can anyone tell me the range of ascii values that are numbers???

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    48 to 57
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    'easy way to get an ascii of your keypress
    Code:
    Private Sub Text1_KeyPress(KeyAscii As Integer)
        MsgBox KeyAscii
    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  4. #4

    Thread Starter
    Member
    Join Date
    Oct 2000
    Location
    UK
    Posts
    36

    Question How about this?

    Do you know of any problems the following could cause?
    'Test for numeric ascii values?
    If Not IsNumeric(Chr(KeyAscii))

  5. #5
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    None if it's in the right event..ie Keypress as below
    However, that does not allow for backspace or decimals if
    needed.

    'allow only numeric data in a textbox

    Option Explicit

    Private Sub Text1_KeyPress(KeyAscii As Integer)

    If Not IsNumeric(Chr(KeyAscii)) Then
    KeyAscii = 13
    Beep 'if not numeric then beep

    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

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