Solved

Find items in ListView

Posted on 2004-04-11
3
376 Views
Last Modified: 2008-02-01
Hi,

Can anyone please let me know how to search listview items in vb.net. I have a listview whose items are populated with strings. I need to compare the listview items with strings. For every match, I need to get the index of the listview item and select it.

Thanks in advance,
Pratibha

0
Comment
Question by:pratibharao
3 Comments
 
LVL 19

Accepted Solution

by:
Desp earned 75 total points
ID: 10803709
Dim lv As ListViewItem
For Each lv In ListView1.Items
            If lv.Text = "MatchingString" Then
                lv.Selected = True
                ' MsgBox(lv.Index) 'at the end of this loop the ListView1.SelectedIndices will contain all the selected rows in LV
            End If
Next
0
 

Expert Comment

by:kantrishi
ID: 11126025
By putting above mentioned code, we have to pass exact matching string to find, i would like to know is there any method so that we can send partial string so that we could find number of row for partial match

Thanks and regards,

Rishi Kant
0
 
LVL 27

Expert Comment

by:Dabas
ID: 13178314
Hi pratibharao:
This might be of help:

http://www.codeproject.com/useritems/LVFind.asp

Dabas
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now