?
Solved

Find items in ListView

Posted on 2004-04-11
3
Medium Priority
?
388 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 19

Accepted Solution

by:
Fahad Mukhtar earned 300 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

764 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