null field into Listview
-
Hello all, How do I supplement the code below so that when a subitem is null from the database, the field in the listview is populated with a string; such as "n/a"? There will be occasions when a field(s) corresponding to a subitem(s) might be null. ///////////////////// Public Sub FillListView() Dim fieldCtr As Short Dim rdlv As SqlDataReader rdlv = sqlCmd.ExecuteReader Do While rdlv.Read lvItems = New ListViewItem lvItems.Text = Trim(rdlv(0)) For fieldCtr = 1 To rdlv.FieldCount() - 1 If rdlv.IsDBNull(fieldCtr) Then lvitems.SubItems.Add("") Else lvitems.SubItems.Add(rdlv.GetString(1)) lvitems.SubItems.Add(rdlv.GetString(2)) lvitems.SubItems.Add(rdlv.GetString(3)) lvitems.SubItems.Add(rdlv.GetString(4)) lvitems.SubItems.Add(rdlv.GetString(5)) lvitems.SubItems.Add(rdlv.GetString(6)) lvitems.SubItems.Add(rdlv.GetDateTime(7)) 'lvItems.SubItems.Add(rdlv.GetDateTime(8)) End If Next fieldCtr Me.lvSearchProperty.Items.Add(lvItems) Loop Me.btnSubmit.Enabled = False End Sub //////////////// Thanks a bunch, Jaydeanster Ben, is that you?