Coffeehouse Post

Single Post Permalink

View Thread: Help needed - Visual Basic .NET
  • User profile image

    Wouldn't this have been easier, to avoid using an index in the first place:

    For Each itm as ListItem In ListView1.Items
       If itm.Text = strName Then
          MsgBox "Matches"
       End If
    Next itm

    Also, assuming you only want to get the first, and possibly only, match, you can insert in an:
      Exit For
    after the MsgBox.