How to check in vb6 ** if variable value is a string(except for special character**) or number?
Thanks,
- Jeff -
How to check in vb6 ** if variable value is a string(except for special character**) or number?
Thanks,
- Jeff -
You can check for various types. This comes from stackoverflow:
Private Sub Command1_Click()
Dim x As Variant
''//These are all different types:
x = "1"
'x = 1
'x = 1&
'x = 1#
Select Case VarType(x)
Case vbEmpty
Case vbNull
Case vbInteger
Label1 = "Integer"
Case vbLong
Case vbSingle
Case vbDouble
Case vbCurrency
Case vbDate
Case vbString
Label1 = "String"
Case vbObject
Case vbError
Case vbBoolean
Case vbVariant
Case vbDataObject
Case vbDecimal
Case vbByte
Case vbUserDefinedType
Case vbArray
Case Else
End Select
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.