How to filter a listview that matches only with a keyword?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dexter delleva
    New Member
    • Feb 2011
    • 12

    How to filter a listview that matches only with a keyword?

    this is my line of codes. but it only compares to the equal match on the textbox. is there any way where i can match even just a keyword and will select all items with the same keyword that i type on textbox.

    [LEFT]
    For i = 0 To ListView1.Items .Count - 1
    If ListView1.Items (i).SubItems(1) .Text.ToLower = TextBox1.Text.T oLower Then
    ListView1.Items (i).Selected = True
    ListView1.Ensur eVisible(i)
    End If
    Next
    [/RIGHT]

    tnx in advance!
  • MrMancunian
    Recognized Expert Contributor
    • Jul 2008
    • 569

    #2
    You could use
    Code:
    ListView1.Items(i).SubItems(1).Text.ToLower.Contains(Textbox1.Text.ToLower)
    to check if the listviewitem contains your string somewhere.

    Steven

    Comment

    Working...