Information.IsDBNull Method
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Returns a Boolean value indicating whether an expression evaluates to the System.DBNull class.
Namespace: Microsoft.VisualBasic
Assembly: Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)
Syntax
'Declaration
Public Shared Function IsDBNull ( _
Expression As Object _
) As Boolean
public static bool IsDBNull(
Object Expression
)
Parameters
- Expression
Type: System.Object
Required. Object expression.
Return Value
Type: System.Boolean
Returns a Boolean value indicating whether an expression evaluates to the System.DBNull class.
Remarks
IsDBNull returns True if the data type of Expression evaluates to the DBNull type; otherwise, IsDBNull returns False.
The System.DBNull value indicates that the Object represents missing or nonexistent data. DBNull is not the same as Nothing, which indicates that a variable has not yet been initialized. DBNull is also not the same as a zero-length string (""), which is sometimes referred to as a null string.
Examples
This example uses the IsDBNull function to determine if a variable evaluates to DBNull.
Dim testVar As Object
Dim nullCheck As Boolean
nullCheck = IsDBNull(testVar)
testVar = ""
nullCheck = IsDBNull(testVar)
testVar = System.DBNull.Value
nullCheck = IsDBNull(testVar)
' The first two calls to IsDBNull return False; the third returns True.
Version Information
Silverlight
Supported in: 5, 4, 3
Platforms
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
See Also