L
Lou
What's the .NET equivalent
Dim strTmp as string
If strTmp=vbNullString
Dim strTmp as string
If strTmp=vbNullString
Dim strTmp as string
If strTmp=vbNullString
I don't understand what <=> means. Does that mean less than, equal to, and
greater than?
I assumed the OP was asking about converting vbNullString from VB6 to
VB.Net.
Null does not equal vbNullString in VB6. They are two completely different
things.
String.Empty is the replacement for vbNullString.
String.Empty = ""
Nothing = ""
String.Empty = Nothing --> True
Note that you can not do this:
Dim str As String
Debug.Print(str)
You *must* assign a value to str before you can display or print it, even
if it's String.Empty. For this reason, many people initialize their strings
like this:
Dim str As String = String.Empty
Robin S.
Rad said:Hey Robin,
vbNullString is not equal to String.Empty. String.Empty equates to "",
the
zero length string. The MSDN documentation specifically states that
vbNullString is not the same as a zero-length string.
I think the closest thing would be nothing
Jim Carlock said:"RobinS" posted...
: So here's my algebraic thinking.
:
: In vb6: ?vbNullString = "" --> true
: In VB.Net: ?String.Empty = "" --> true
: (?Nothing = "" --> true, so this is weird)
:
: Algebraically speaking, if (a = b) and (b = c) then (a = c).
:
: [...]
:
: Unless algebra doesn't hold true for .Net programming, in which
: I'm screwed.
Golly Gee Batman!
Not True <> False!
Not False <> True!
If (a = True), (b = False), (c = True) Then
a + b = c and
b + c = c
b + c = a
Algebra does not apply! What shall we call the Screwy one,
Batman?!?
Screwballs, Robin!
So here's my algebraic thinking.
In vb6: ?vbNullString = "" --> true
In VB.Net: ?String.Empty = "" --> true
(?Nothing = "" --> true, so this is weird)
Algebraically speaking, if (a = b) and (b = c) then (a = c).
Therefore, if (vbNullString = '") and ("" = String.Empty),
then (vbNullString = String.Empty).
That's my theory!
Unless algebra doesn't hold true for .Net programming, in which I'm
screwed.
Robin S.
Rad said:Looks like MSDN is a bit of a goof. Much as it says string.Empty <> "" A
quick console application shows otherwise
Console.WriteLine(String.Empty="") -> True
Console.WriteLine(string.Empty=nothing) -> True