Funzione IsNothing

Aggiornamento: novembre 2007

Restituisce un valore Boolean in cui è specificato se a un'espressione non è assegnato alcun oggetto.

Public Function IsNothing(ByVal Expression As Object) As Boolean

Parametri

  • Expression
    Obbligatorio. Espressione Object.

Note

Il valore restituito dalla funzione IsNothing sarà True se l'espressione rappresenta una variabile oggetto a cui non è assegnato alcun oggetto. In caso contrario, il valore restituito sarà False.

La funzione IsNothing deve essere utilizzata sui tipi di riferimento. Un tipo di valore non può contenere un valore Nothing. Pertanto, se a tale tipo viene assegnato Nothing, verrà ripristinato il relativo valore predefinito. Se si specifica un tipo di valore in Expression, IsNothing restituirà sempre False.

Esempio

Nell'esempio riportato di seguito la funzione IsNothing viene utilizzata per determinare se una variabile oggetto è associata a un'istanza di oggetto.

Dim testVar As Object
' No instance has been assigned to variable testVar yet.
Dim testCheck As Boolean
' The following call returns True.
testCheck = IsNothing(testVar)
' Assign a string instance to variable testVar.
testVar = "ABCDEF"
' The following call returns False.
testCheck = IsNothing(testVar)
' Disassociate variable testVar from any instance.
testVar = Nothing
' The following call returns True.
testCheck = IsNothing(testVar)

Requisiti

Spazio dei nomi: Microsoft.VisualBasic

Modulo: Information

**Assembly:**Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)

Vedere anche

Concetti

Tipi valore e tipi riferimento

Riferimenti

Funzione IsArray (Visual Basic)

Funzione IsDate (Visual Basic)

Funzione IsDBNull

Funzione IsError

Funzione IsNumeric (Visual Basic)

Funzione IsReference

Tipo di dati Object

Funzione TypeName (Visual Basic)