0 difference (the empty string), Null, Empty, and to Nothing

Dim A

Dim B As String

Dim C As Integer

Dim D As Object

A equals Empty, because uninitialized "indefinite variables" are equal Empty. However, if the check

Measuring A = "" or A = 0, can also be obtained value of True.

B equals "", has not been initialized because of non-fixed length "string" are equal to "." However, please note

B<> Null。

C is equal to 0, there is this problem?

D is equal to Nothing, the object has not been set "object variable" are equal to Nothing, but please do not

To use D = Nothing, and to the use of D Is Nothing to determine whether D is equal to Nothing,

Because determines whether Is is not equal to the symbol =.

The most confusing place is Null This reserved word, consider the following statement:

Print X = Null

Print X <> Null

The results are output Null (not True nor False), it is only because any expression

To contain Null, then the expression is equal to Null, in fact, you want to judge whether certain data is Null

Must not be used:

If X = Null Then 'will always give Null

Instead, use:

If IsNull(X) Then

What kind of data is equal to Null it? In addition to containing Null expression, in the case without any input

What data "data field" (in the database) will be equal to Null.


Reproduced in: https: //www.cnblogs.com/kevinGao/archive/2011/11/04/2236173.html

Guess you like

Origin blog.csdn.net/weixin_33874713/article/details/93361107