Serialcoder en Français Serialcoder in English
TEL : +33 (0)9 72 13 15 17

Windows Forms FAQ resources

4. Windows Forms Data Binding

4.3 How do I test for a null value in DataView.RowFilter?


You can use the IsNull operator.

[C#]
     //the outer quotes are double quotes and the inner quotes are 2 single quotes
     //Fax is the column mapping name
     this.dataView1.RowFilter = "IsNull(Fax, '') = ''";

     // for a numeric null in custNo (suggested by Bob Gibson)
     this.dataView1.RowFilter = "IsNull(custNo, 0) = 0";

[VB.NET]
     'the outer quotes are double quotes and the inner quotes are 2 single quotes
     'Fax is the column mapping name
     Me.dataView1.RowFilter = "IsNull(Fax, '') = ''"

     ' for a numeric null in custNo (suggested by Bob Gibson)
     Me.DataView1.RowFilter = "IsNull(custNo, 0) = 0"