Solved

Find items in ListView

Posted on 2004-04-11
3
381 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
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…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

809 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