Consider the following 2 statements (VB.NET):
Dim Button1 As System.Windows.Forms.Button
Dim Button2 As New System.Windows.Forms.Button()
The .NET Framework 2.0 SDK states that:
The first statement declares an object variable that can contain a
reference to a button object. However, the variable Button1 contains
the value Nothing until you assign an object of type Button to it. The
second statement also defines a variable that can contain a button
object, but the New keyword creates a button object and assigns it to
the variable Button2.
I couldn't exactly follow the difference stated above. The value of the
variable Button1 is Nothing but then what is the value of Button2?
Moreover, why is the value of the variable Button1 Nothing? Also is
"declaring an object variable" same as "defining an object variable"?
Can someone please explain me the difference in a simpler way, if
possible?
Thanks,
Arpan