|
-
Feb 24th, 2008, 08:32 PM
#1
Thread Starter
Addicted Member
If text in textbox is not numeric then..
How would I create a command that checks to see the text in a textbox and if its not numeric then to display a message..
For example..
Code:
Private Sub cmdgo_Click()
If Text1.text = Not Numeric Then
Msgbox "Not Numeric"
End If
Thankyou
-
Feb 24th, 2008, 08:59 PM
#2
Re: If text in textbox is not numeric then..
Code:
Private Sub cmdgo_Click()
If IsNumeric(Text1.text) =False Then
Msgbox "Not Numeric"
End If
-
Feb 24th, 2008, 09:03 PM
#3
Re: If text in textbox is not numeric then..
Waiting for a full featured smart phone with out marrying a provider
Go Android
Go raiders 
-
Feb 24th, 2008, 09:57 PM
#4
Frenzied Member
Re: If text in textbox is not numeric then..
Code:
If Not IsNumeric(Text1.Text) Then
-
Feb 25th, 2008, 01:41 AM
#5
Re: If text in textbox is not numeric then..
That's another way to use my code Zach_VB6
-
Feb 25th, 2008, 02:59 AM
#6
Frenzied Member
Re: If text in textbox is not numeric then..
-
Feb 25th, 2008, 04:10 PM
#7
Re: If text in textbox is not numeric then..
 Originally Posted by Zach_VB6
Code:
If Not IsNumeric(Text1.Text) Then
Note that if the textbox reads "1/2", IsNumeric will say that it is not numeric because the forward slash is not considered a numeric by IsNumeric. Some might consider this a weakness. Other examples can also be identified, such as the factorial sign !, brackets, and braces. On the other hand, parentheses are considered numeric, so I think there is some judgment calls going on here.
Just my $0.02.
-
Feb 25th, 2008, 09:46 PM
#8
Fanatic Member
Re: If text in textbox is not numeric then..
You could
n Code:
Private Sub cmdgo_Click()
text1.text = replace (text1.text,"/","")
If IsNumeric(Text1.text) =False Then
Msgbox "Not Numeric"
End If
 Originally Posted by Code Doc
Note that if the textbox reads "1/2", IsNumeric will say that it is not numeric because the forward slash is not considered a numeric by IsNumeric. Some might consider this a weakness. Other examples can also be identified, such as the factorial sign !, brackets, and braces. On the other hand, parentheses are considered numeric, so I think there is some judgment calls going on here.
Just my $0.02.
Live life to the fullest!!
-
Feb 25th, 2008, 10:10 PM
#9
Re: If text in textbox is not numeric then..
Code Doc is correct. A one size fits all approach through IsNumeric() is not always appropriate because of the way the function works, e.g. "2E5" returns True but that isn't so for an IP address octet or a cash amount. And newprogram, "1//2" should not be a valid expression.
Last edited by leinad31; Feb 25th, 2008 at 10:13 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|