Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27351

VS 2012 "= Nothing" vs "Is Nothing"

$
0
0
Hello,

I'm not understanding the use of "Is Nothing".
In the following code, the first "If" uses "Is Nothing" while the second one
uses "= Nothing". It appears that the "= Nothing" is working properly (i.e. the
MsgBox line is output) when my collection variable has a null string ("") in the
specified location but the "Is Nothing" version does not output to the MsgBox.

%Code%

If CompListColl(6).PPMpins(2).Pin2 Is Nothing Then
MsgBox("6/2/2 is Nothing")
End If
'test
If CompListColl(6).PPMpins(2).Pin2 = Nothing Then
MsgBox("6/2/2 = Nothing")
End If

%Code%

Isn't this, essentially, equivalent code?

Confused in CA.

Thanks in advance,
Grant

Viewing all articles
Browse latest Browse all 27351

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>