DataRow.IsNull Method
Gets a value indicating whether the specified column contains a null value.
Overload List
Gets a value indicating whether the specified DataColumn contains a null value.
Supported by the .NET Compact Framework.
[Visual Basic] Overloads Public Function IsNull(DataColumn) As Boolean
[C#] public bool IsNull(DataColumn);
[C++] public: bool IsNull(DataColumn*);
[JScript] public function IsNull(DataColumn) : Boolean;
Gets a value indicating whether the column at the specified index contains a null value.
Supported by the .NET Compact Framework.
[Visual Basic] Overloads Public Function IsNull(Integer) As Boolean
[C#] public bool IsNull(int);
[C++] public: bool IsNull(int);
[JScript] public function IsNull(int) : Boolean;
Gets a value indicating whether the named column contains a null value.
Supported by the .NET Compact Framework.
[Visual Basic] Overloads Public Function IsNull(String) As Boolean
[C#] public bool IsNull(string);
[C++] public: bool IsNull(String*);
[JScript] public function IsNull(String) : Boolean;
Gets a value indicating whether the specified DataColumn and DataRowVersion contains a null value.
Supported by the .NET Compact Framework.
[Visual Basic] Overloads Public Function IsNull(DataColumn, DataRowVersion) As Boolean
[C#] public bool IsNull(DataColumn, DataRowVersion);
[C++] public: bool IsNull(DataColumn*, DataRowVersion);
[JScript] public function IsNull(DataColumn, DataRowVersion) : Boolean;
Example
[Visual Basic] The following example changes the value of a column to a null value, then uses the IsNull method to determine if the value is null.
[Visual Basic] Note This example shows how to use one of the overloaded versions of IsNull. For other examples that might be available, see the individual overload topics.
[Visual Basic]
Private Sub IsValNull()
Dim t As DataTable
Dim r As DataRow
' Assuming the DataGrid is bound to a DataTable.
t = CType(DataGrid1.DataSource, DataTable)
r = t.Rows(datagrid1.CurrentCell.RowNumber)
r.BeginEdit
r("FirstName") = System.DBNull.Value
r.EndEdit
r.AcceptChanges
Console.WriteLine(r.IsNull("FirstName"))
End Sub
[C#, C++, JScript] No example is available for C#, C++, or JScript. To view a Visual Basic example, click the Language Filter button
in the upper-left corner of the page.