Results 1 to 2 of 2

Thread: check if number

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2004
    Posts
    7

    check if number

    I have the tipical "check if valid" in a TextFiled

    How can I Check if a String is a number... (int or double)


    If isNotNumber(MyString) Then
    ThisTextField.SetFocus()

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974
    This will check that any text is a number:
    VB Code:
    1. If Not isNumeric(MyString) Then
    2.   ThisTextField.SetFocus()
    3. End If

    and this will do the same, plus make sure that something has been entered (the above will allow empty text)
    VB Code:
    1. If (Not isNumeric(MyString)) Or (MyString = "") Then
    2.   ThisTextField.SetFocus()
    3. End If

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