Difference between revisions of "Null"

From HashVB
Jump to: navigation, search
(Added the Glossary catagory)
 
(3 intermediate revisions by one user not shown)
Line 1: Line 1:
 +
{{VB6}}
 
Null in the computer world basically means "nothing".
 
Null in the computer world basically means "nothing".
  
Line 12: Line 13:
 
* vbNullChar - This is the Null character mentioned earlier and is the same as Chr$(0)
 
* vbNullChar - This is the Null character mentioned earlier and is the same as Chr$(0)
 
* vbNullString - A Null string is a pointer to nothing (0) which is subtly different to an empty string (a pointer to a zero length string). In most cases these are interchangable in VB.
 
* vbNullString - A Null string is a pointer to nothing (0) which is subtly different to an empty string (a pointer to a zero length string). In most cases these are interchangable in VB.
* Nothing - The Nothing keyword is used when working with objects and is basically a pointer to nothing. This is the state of all uninitialized object variables and is also used to release an object.
+
* Nothing - The Nothing keyword is used when working with objects and is a pointer to nothing. This is the state of all uninitialized object variables and is also used to release an object.
 +
 
 +
These two aren't keywords themselves but are null states of variants:
 +
* Empty - This is an uninitialised variant that contains no specific type or data. This is the default state for variants.
 +
* Missing - This is a special type of variant that is only used with optional varant parameters to functions.
 +
 
 +
[[Category:Glossary]]

Latest revision as of 11:02, 16 February 2007

float
 This article is based on Visual Basic 6. Find other Visual Basic 6 articles.

Null in the computer world basically means "nothing".

It is normally used in 3 main contexts:

  • Null parameter/variable - This basically means "pointer to nothing" and is used by some functions to mean you don't have anything to pass it.
  • Null character - Null characters have an ASCII code of 0 and are sometimes used to mark the end of strings or to separate multiple values.
  • Null values in databases - Null is used to show the database field has nothing in it. This is different to 0 or an empty string ("") which are both valid values provided this is specified as such in the table creation or by the DB driver.

There are several "Nulls" in VB, all of which are easily confused.

Uses of Null in VB:

  • vbNull - This should only be used when working with the VarType() function. You will have very little cause to use this.
  • vbNullChar - This is the Null character mentioned earlier and is the same as Chr$(0)
  • vbNullString - A Null string is a pointer to nothing (0) which is subtly different to an empty string (a pointer to a zero length string). In most cases these are interchangable in VB.
  • Nothing - The Nothing keyword is used when working with objects and is a pointer to nothing. This is the state of all uninitialized object variables and is also used to release an object.

These two aren't keywords themselves but are null states of variants:

  • Empty - This is an uninitialised variant that contains no specific type or data. This is the default state for variants.
  • Missing - This is a special type of variant that is only used with optional varant parameters to functions.