Is Split Buggy? Why Isn't 0 a Number?
This is weird.
Could anyone Try this code and tell me if 0 is consistently a number or not?
VB Code:
Private Sub Command2_Click()
Dim MY_STR As String
MY_STR = "1 + 0"
MY_STUFF = Split(MY_STR, " ", -1, vbTextCompare)
For Each One In MY_STUFF
Select Case One
Case ""
MsgBox "NULL"
Case "+"
MsgBox "PLUS"
Case IsNumeric(One) = True
MsgBox One & " is a Number"
Case Else
MsgBox One & " is Not a Number"
End Select
Next One
MY_STR = "0"
If IsNumeric(MY_STR) Then
MsgBox MY_STR & " is a number"
Else
MsgBox MY_STR & " is NOT a number"
End If
End Sub
The following is even worse, 1 isn't even a number anymore!
VB Code:
Private Sub Command2_Click()
Dim MY_STR As String
Dim Two As String
MY_STR = "1 + 0"
MY_STUFF = Split(MY_STR, " ", -1, vbTextCompare)
For Each One In MY_STUFF
Two = One
Select Case Two
Case ""
MsgBox "NULL"
Case "+"
MsgBox "PLUS"
Case IsNumeric(Two) = True
MsgBox Two & " is a Number"
Case Else
MsgBox Two & " is Not a Number"
End Select
Next One
End Sub
Am I Missing something? Or should I ReBoot / ReIntsall VB?
:confused: :confused: :confused:
-Lou