Gets a value indicating whether the column at the specified index contains a null value.
[Visual Basic] Overloads Public Function IsNull( _ ByVal columnIndex As Integer _ ) As Boolean [C#] public bool IsNull( int columnIndex ); [C++] public: bool IsNull( int columnIndex ); [JScript] public function IsNull( columnIndex : int ) : Boolean;
true if the column contains a null value; otherwise, false.
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]
Private Sub IsValNull() Dim t As DataTable ' Assuming the DataGrid is bound to a DataTable. t = DataGrid1.DataSource Dim r As DataRow r = t.Rows(datagrid1.CurrentCell.RowNumber) r.BeginEdit r(1) = dbNull r.EndEdit r.AcceptChanges Console.WriteLine(r.IsNull(1)) End Sub
DataRow Class | DataRow Members | System.Data Namespace | DataRow.IsNull Overload List