954,541 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Search In Listview

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
Mindazz
Newbie Poster
7 posts since Sep 2010
Reputation Points: 10
Solved Threads: 0
 

Bump. ;)

Mindazz
Newbie Poster
7 posts since Sep 2010
Reputation Points: 10
Solved Threads: 0
 


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
Unhnd_Exception
Posting Pro
570 posts since Nov 2010
Reputation Points: 249
Solved Threads: 201
 

Thanks. :)

Mindazz
Newbie Poster
7 posts since Sep 2010
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: