Yes and no....
-----------------------------------
Dim s as String
Debug.WriteLine(s is Nothing) ' True
Debug.WriteLine(s = Nothing) ' True
Debug.WriteLine(s = "") ' True
s = "" ' Same as s = String.Empty
Debug.WriteLine(s is Nothing) ' False
Debug.WriteLine(s = Nothing) ' True
------------------------------------
"s = Nothing" tests to see if it is not assigned to anything OR is equal to
""
"s is nothing" only tests to see if it is not assigned to anything
i.e.
--------------------------
If s = nothing then
.....
' is equlvelent to
If s is nothing orelse s = String.Empty then
....
--------------------------
If you want short code to test for empty strings, use
If s = "" then
but beware of performance if doing this in a big loop because of string
comparisons. The following may have a slight performance advantage:
If s is nothing orelse s.Length = 0 then
HTH,
Trev.