I’m doing some work on a legacy application, and my VB6 skills aren’t that great. I need to check whether a String field has been initialized and set to something other than null/nothing or an empty string. In C# I’d just do something like:
if (string.IsNullOrEmpty(myObj.Str))
I’m not sure what the equivalent to this was in VB6, and I’m nervous about using If myObj.Str = "" and calling it good. What’s the correct way to do this?
To clarify, I want something that will return True if any of the following are true:
- The field hasn’t been initialized
- The field is an empty string (str = “”, length = 0)
- The field is set to null, or Nothing, or vbnull, or whatever form of the null value applies to VB6 strings.
The field was originally a Long, and the code I’m replacing checked whether it was set to 0.
VB6 was designed to be easy
Use