指定したインデックス位置にある列に null 値が格納されているかどうかを示す値を取得します。
Overloads Public Function IsNull( _
ByVal columnIndex As Integer _) As Boolean
[C#]
public bool IsNull(intcolumnIndex);
[C++]
public: bool IsNull(intcolumnIndex);
[JScript]
public function IsNull(
columnIndex : int) : Boolean;
パラメータ
- columnIndex
列の 0 から始まるインデックス番号。
戻り値
列が null 値を格納している場合は true 。それ以外の場合は false 。
使用例
[Visual Basic] 列の値を null 値に変更し、 IsNull メソッドを使用して、列の値が null かどうかを確認する例を次に示します。
Private Sub IsValNull()
Dim t As DataTable
' Assuming the DataGrid is bound to a DataTable.
t = CType(DataGrid1.DataSource, DataTable)
Dim r As DataRow
r = t.Rows(datagrid1.CurrentCell.RowNumber)
r.BeginEdit
r(1) = System.DBNull.Value
r.EndEdit
r.AcceptChanges
Console.WriteLine(r.IsNull(1))
End Sub
[C#, C++, JScript] C#、C++、および JScript のサンプルはありません。Visual Basic のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET
参照
DataRow クラス | DataRow メンバ | System.Data 名前空間 | DataRow.IsNull オーバーロードの一覧