title: How do I check for a null or empty item in a ListView SubItem?
body: <p>I have created this listview box that when contents are double clicked the values are inserted into text boxes. There are spaces in some items and a couple have null values in the subitems.  When these particular list items are clicked it crashes the software. Is there a way I can check if a subitem is null or empty?</p>
  
  <pre><code>Private Sub ListView1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView1.DoubleClick
      For i As Integer = 1 To 7
          Dim tbName As String = "TextBox" &amp; i
          Dim matches() As Control = Me.Controls.Find(tbName, True)
          If matches.Length &gt; 0 AndAlso TypeOf matches(0) Is TextBox Then
              Dim tb As TextBox = DirectCast(matches(0), TextBox)
              If tb.Text.Trim.Length = 0 Then
                  tb.Text = ListView1.SelectedItems(0).SubItems(0).Text
                  Exit Sub
              End If
          End If
      Next
  </code></pre>