R
Rob Richardson
Greetings!
I am an experienced VB6 user just getting into the VB .Net world. In VB6,
many people frowned on the use of "Dim x As New MyObject" because it could
produce unexpected results, such as the following:
Dim X as New MyObject
Set X = Nothing
If X Is Nothing Then
MsgBox "X has been destroyed"
Else
MsgBox "Why the heck is X still here?"
EndIf
In the above VB6 code, X is recreated in the If statement because of the use
of Dim as New, and the second message box appears. Does VB.Net behave the
same way?
Thanks!
Rob
I am an experienced VB6 user just getting into the VB .Net world. In VB6,
many people frowned on the use of "Dim x As New MyObject" because it could
produce unexpected results, such as the following:
Dim X as New MyObject
Set X = Nothing
If X Is Nothing Then
MsgBox "X has been destroyed"
Else
MsgBox "Why the heck is X still here?"
EndIf
In the above VB6 code, X is recreated in the If statement because of the use
of Dim as New, and the second message box appears. Does VB.Net behave the
same way?
Thanks!
Rob