andreas said:
Can someone tell me
1)
Is there a difference between closing or disposing a reference data
type
Closing is not a default pattern. Disposing is, and it's described in the
Framework docs. Some classes might have a Close method, some are disposable,
some have both. Whether closing is the same as disposing depends on the
class. Look at the docs of the class. There is no general answer.
2)
about nothing
dim fr as form2
isnothing(fr) gives true
but
dim fr as form2
fr = new form2
fr.dispose
isnothing(fr) gives false
what means nothing?
Nothing means "no reference". A variable declared As Object or As a
reference type (classes are reference types), are pointers to an object. A
pointer is the address of the object in memory. If the variable is 0, it is
Nothing.
To compare reference, use the Is operator:
If a Is b Then 'True if both variables reference the same object
If a Is Nothing Then True if variable a is Nothing
Don't use the "IsNothing" function. Use the Is operator as shown because it
directly does what has to be done. The IsNothing function does the same, but
there's no need to call a function for this.
In your first example, "fr" is Nothing because you didn't assign anything,
so it's nothing if you check it. In the 2nd example, you assigned the
reference to an object (of type Form2), so it's not Nothing.
Armin