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

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

# Problems with Variable Testing

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

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