Problems with Variable Testing - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Problems with Variable Testing

5thshadow5thshadow Posts: 2Member
[b][red]This message was edited by 5thshadow at 2005-10-19 6:52:55[/red][/b][hr]
How would I do the opposite of 'variable = CInt(Val(txtInput.Text))', like if you enter a number it would return a value of 0

Comments

  • GogiGogi Posts: 258Member
    : [b][red]This message was edited by 5thshadow at 2005-10-19 6:52:55[/red][/b][hr]
    : How would I do the opposite of 'variable = CInt(Val(txtInput.Text))', like if you enter a number it would return a value of 0
    :

    What do you mean?
    Please give more details.
  • rlcrlc Posts: 448Member
    Simple way to check for a number....

    [code]
    If Not IsNumeric(txtInput.Text) Then
    'it is not a number
    variable = .....
    End if[/code]

    If you want something more complex that can account for specific special characters and such, you need to learn how to write a Regular Expression, google it and you will find plenty of examples.


    ~rlc




    : : [b][red]This message was edited by 5thshadow at 2005-10-19 6:52:55[/red][/b][hr]
    : : How would I do the opposite of 'variable = CInt(Val(txtInput.Text))', like if you enter a number it would return a value of 0
    : :
    :
    : What do you mean?
    : Please give more details.
    :
  • 5thshadow5thshadow Posts: 2Member
    Thanks rlc, that's exactly what I was looking for

    : Simple way to check for a number....
    :
    : [code]
    : If Not IsNumeric(txtInput.Text) Then
    : 'it is not a number
    : variable = .....
    : End if[/code]
    :
    : If you want something more complex that can account for specific special characters and such, you need to learn how to write a Regular Expression, google it and you will find plenty of examples.
    :
    :
    : ~rlc
    :
    :
    :
    :
    : : : [b][red]This message was edited by 5thshadow at 2005-10-19 6:52:55[/red][/b][hr]
    : : : How would I do the opposite of 'variable = CInt(Val(txtInput.Text))', like if you enter a number it would return a value of 0
    : : :
    : :
    : : What do you mean?
    : : Please give more details.
    : :
    :
Sign In or Register to comment.