Hello.

I can search for items in first listview column using FindItemWithText. I wonder is it possible to search in other listview columns and highlight found text, not all item line ? :?: Searched on google all day long but no luck... :sad:

My Listview contains multiple items and each item has 9 subitems. I would like to search in column 4.

Thanks in advance for any help! :icon_wink:

My code i use to search in first column.

Dim findItem As ListViewItem = ListView1.FindItemWithText(TextBox1.Text, False, 0, True)


        If findItem IsNot Nothing Then
            ListView1.MultiSelect = False
            ListView1.TopItem = findItem

            findItem.Selected = True
        End If

Recommended Answers

Seems like you could do it with this

ListView1.Focus()

 For i = 0 To ListView1.Items.Count - 1
     If ListView1.Items(i).SubItems(3).Text = TextBox1.Text Then
          ListView1.Items(i).Selected = True
     End If
 Next
Jump to Post

All 5 Replies

Bump. ;)

Member Avatar

Seems like you could do it with this

ListView1.Focus()

 For i = 0 To ListView1.Items.Count - 1
     If ListView1.Items(i).SubItems(3).Text = TextBox1.Text Then
          ListView1.Items(i).Selected = True
     End If
 Next
commented: Thanks! +1

Thanks. :)

i does'nt understand....................please help me ..........
i want to make a program, that can search item from list view, and what ever word or letter in textbox that will search in listview............PLEASE HELP ME!!!!!
I AM USING VISUAL BASIC 2010

THANKING YOU IN ADVANCE

The code given is looping through the listview Items and seeing if the sub item at index 3 ( which is column 4,) has the text that was entered in the textbox.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.