Results 1 to 7 of 7

Thread: checking for numeric result from input

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2000
    Posts
    22
    I am trying to put in a check for an input box so I can tell if a numeric value was entered. What expression do I write to do this? If it is not numeric I will send an alert then set focus to that field to have then re-enter it.

  2. #2
    Junior Member
    Join Date
    Nov 2000
    Location
    South Carolina
    Posts
    16

    IsNumeric

    The IsNumeric(x) function returns a true/false for if "x" is numeric or not
    Jonathan

  3. #3
    Hyperactive Member noble's Avatar
    Join Date
    Nov 2000
    Location
    Philly
    Posts
    471

    Lightbulb IsNumeric()

    IsNumeric() works fine.
    it obviously returns a boolean value.
    IsNull() may also be helpful

  4. #4
    Addicted Member
    Join Date
    Oct 1999
    Location
    Brossard, Québec, Canada
    Posts
    241
    Use the ISNUMERIC() function

    If not IsNumeric(MyTextBox) then
    MsgBox "this value is not numeric"
    end if

  5. #5
    Junior Member
    Join Date
    Nov 2000
    Posts
    21

    Wink Chack this out

    You can check for Numeric numbers using a function called IsNumeric.
    Example:
    If IsNumeric(Value) Then
    'Do Whatever
    Else
    ControlName.Setfocus
    MsgBox "You have to enter numeric values only."

    End If
    Rabih Waked
    Using Visual Basic 6 Enterprise Edition with SP4.
    The clock is ticking, the end of days
    A journey awaits...

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Nov 2000
    Posts
    22

    Talking Thanks everyone

    I knew it was something simple like that but I couldn't remember.

  7. #7
    Hyperactive Member noble's Avatar
    Join Date
    Nov 2000
    Location
    Philly
    Posts
    471

    Cool If you wanna be really COOL!!!!

    hey hobbes,
    if you wanna be really cool, you can call an API that
    doesn't even allow you to enter numeric values while inside
    the text box.

    that way, you don't have to fool with the msgboxen (plural,hehe)

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