I am trying to check if a string is numeric but in vain. here is my code:
If Val(fnumField.Text.Trim) > 0 Or fnumField.Text.Trim = "0" Or Val(phnField.Text.Trim) > 0 Or phnField.Text.Trim = "0" Or Val(ophnField.Text.Trim) > 0 Or _
ophnField.Text.Trim = "0" Or Val(treeField.Text.Trim) > 0 Or treeField.Text.Trim = "0" Then
messageBox.Show("number")
Else
messageBox.Show("not number")
EndIf
The problem I have is that when I run the program and insert a character string like “abcd” in one of the textfields like “fnumField”, it still executes the code in the “if” and not in the “else”. What am I not doing right?
try this: