How can you tell if the input value in a textbox is an Integer or String is there any code to know this?
[CODE=vb] If isnumeric(textb ox.text) = True then
Msgbox("I am a number")
Else
msgbox("I'M not anumber ,im mostlikely a string")
End if
[/CODE]
This help?
[CODE=vb] If isnumeric(textb ox.text) = True then
Msgbox("I am a number")
Else
msgbox("I'M not anumber ,im mostlikely a string")
End if
[/CODE]
This help?
Thank you! Thank you! Thank You! very much. You saved my day.
I'd just like to point out that by definition, the value in a textbox is always a string. What you're testing is whether it's possible for VB to convert that string to a number. (Note, IsNumeric() function won't care whether it's an integer - it could be too large for instance).
Oh, and a quick tip, daniel. If you're testing a logical value, there's no point in comparing it to True. It already is True or False. So in this example, the code If IsNumeric(textb ox.Text) = True Then
works exactly the same as If IsNumeric(textb ox.Text) Then.
Except that depending on how smart the compiler is, the shorter version might execute ever so slightyl faster.
Oh, and a quick tip, daniel. If you're testing a logical value, there's no point in comparing it to True. It already is True or False. So in this example, the code If IsNumeric(textb ox.Text) = True Then
works exactly the same as If IsNumeric(textb ox.Text) Then.
Except that depending on how smart the compiler is, the shorter version might execute ever so slightyl faster.
I didn't know this huh? I learned something new for this day. haha : )
Hey...killer..y ou have a valid point... i already knew that...i just always put = True in when trying to explain or if there is more than one statement...so as not to get confused.....
Good point though....
Comment