DifNullMode






These strange values have slightly different meanings.
•Null. Null is a Variant subtype like Integer or String.
It represents a variant that contains no valid data.
This is different from zero, Nothing, Empty, or vbNullString.
Most other values when combined with Null produce a Null result.

For example:
Null - Null is Null not 0
Null + 7 is Null not 7
Null = Null is Null not True
You can use IsNull to determine whether an expression is Null:
If IsNull(my_variable) Then ...
•Empty. This is a variant subtype like Integer or String.
It represents a variable that has not yet been initialized.
This is different from Null which represents a value that
specifically contains no valid data.
A variant variable that has not yet been initialized has the
value Empty.
You can use IsEmpty to see if a variant has been initialized.
If IsEmpty(my_variant) Then ...
•Nothing. This is an object reference that points to no object.
Set an object reference to Nothing to free that reference.
If no other references point to the object,
Visual Basic will destroy the object.
Dim obj As Form1
:
Set obj = Nothing ' Free the object reference.
Use Is Nothing to determine whether a reference points to nothing:
If obj Is Nothing Then ...
•vbNullString. This constant represents an empty string.
This is not the same as a blank string "". It is a nothing string.
It is treated as an empty string "" for most Visual Basic purposes.
Its real use is for passing null parameters to library functions.
Null is a strange value. It is not zero, it is not Nothing,
it is not the same as vbNullString. It is something undefined.

These strange values have slightly different meanings.
•Null. Null is a Variant subtype like Integer or String.
It represents a variant that contains no valid data.
This is different from zero, Nothing, Empty, or vbNullString.
Most other values when combined with Null produce a Null result.

For example:
Null - Null is Null not 0
Null + 7 is Null not 7
Null = Null is Null not True
You can use IsNull to determine whether an expression is Null:
If IsNull(my_variable) Then ...
•Empty. This is a variant subtype like Integer or String.
It represents a variable that has not yet been initialized.
This is different from Null which represents a value that
specifically contains no valid data.
A variant variable that has not yet been initialized has the
value Empty.
You can use IsEmpty to see if a variant has been initialized.
If IsEmpty(my_variant) Then ...
•Nothing. This is an object reference that points to no object.
Set an object reference to Nothing to free that reference.
If no other references point to the object,
Visual Basic will destroy the object.
Dim obj As Form1
:
Set obj = Nothing ' Free the object reference.
Use Is Nothing to determine whether a reference points to nothing:
If obj Is Nothing Then ...
•vbNullString. This constant represents an empty string.
This is not the same as a blank string "". It is a nothing string.
It is treated as an empty string "" for most Visual Basic purposes.
Its real use is for passing null parameters to library functions.
Null is a strange value. It is not zero, it is not Nothing,
it is not the same as vbNullString. It is something undefined.











( difnullmode.html )- by Paolo Puglisi - Modifica del 17/12/2023