VB.NET

Moderators: seancampbell
Number of threads: 4022
Number of posts: 10035

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Problems with Variable Testing Posted by 5thshadow on 18 Oct 2005 at 11:05 AM
This message was edited by 5thshadow at 2005-10-19 6:52:55

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
Report
Re: Problems with Variable Testing Posted by Gogi on 19 Oct 2005 at 3:43 PM
: This message was edited by 5thshadow at 2005-10-19 6:52:55

: 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.
Report
Re: Problems with Variable Testing Posted by rlc on 20 Oct 2005 at 6:40 AM
Simple way to check for a number....

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


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




: : This message was edited by 5thshadow at 2005-10-19 6:52:55

: : 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.
:
Report
Re: Problems with Variable Testing Posted by 5thshadow on 20 Oct 2005 at 10:29 AM
Thanks rlc, that's exactly what I was looking for

: Simple way to check for a number....
:
:
: If Not IsNumeric(txtInput.Text) Then
:    'it is not a number
:     variable = .....
: End if

:
: 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
:
:
:
:
: : : This message was edited by 5thshadow at 2005-10-19 6:52:55

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



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.