Joe,
I would recommend what Herfried showed:
If Typeof obj Is String Then
The difference being is that TypeOf will succeed for derived types, where as
GetType matches the type exactly. For String not much of a difference, for
other types that you derive from, such as Control it can be a world of
difference.
Dim c As Control
c = New TextBox
If TypeOf c Is Control Then
' True : TextBox inherits from Control
End If
If c.GetType() Is GetType(Control) Then
Else
' False : c is actually a TextBox
End If
Hope this helps
Jay
"Joe Fallon" <jf******@nospamtwcny.rr.com> wrote in message
news:ek*************@TK2MSFTNGP10.phx.gbl...
Always figure it out 5 seconds after posting!! <g>
If Object.GetType Is GetType(String) Then
--
Joe Fallon
"Joe Fallon" <jf******@nospamtwcny.rr.com> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl... I would like to know the syntax to check that an Object is a String.
If it was a number test I might use IsNumeric.
But there is no function: IsString (is there?)
--
Joe Fallon