Null

From HashVB
Revision as of 01:50, 30 August 2005 by Dee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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 show the database field has nothing in it. This is different to 0 or an empty string ("") which are both valid values.

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 basically a pointer to nothing. This is the state of all uninitialized object variables and is also used to release an object.