Results 1 to 4 of 4

Thread: Finding items in a LISTVIEW Control

Hybrid View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2002
    Posts
    26

    Finding items in a LISTVIEW Control

    Does anyone know how to find an item in a LISTVIEW control?

    In VB6 there was a FINDITEM method that you could use. I dont see that method in .NET

    In VB6 you could do this:

    Set itmFound = lstConnections.FindItem(Name, lvwSubItem)
    If itmFound Is Nothing Then
    'do nothing
    Else
    lstConnections.ListItems.add (name)
    End If

    In vb.net????

    I could loop through all the items.....yuch...any ideas?

  2. #2
    Addicted Member
    Join Date
    Jul 1999
    Posts
    207
    The only way that I am aware of is to loop through the items.

    Dim A As Windows.Forms.ListViewItem
    For Each A In ListView1.Items
    If A.Text = "What you are looking for" Then
    MsgBox("Item Fount At:" & A.Index)
    End If
    Next

    Jeremy

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Sep 2002
    Posts
    26

    Red face Looping I guess it is......

    I was hoping for a slicker way but I guess looping will have to suffice. Thanks for your help!

  4. #4
    Fanatic Member
    Join Date
    Sep 2002
    Posts
    518
    Yeah I've been looking for a way to find items in a listview and that's the only way I came up with also (looping).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width