# Problems with Variable Testing

[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

• : [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?
• 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?
:
• 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.
: :
: