Solved

Compare Dataset with Listview Items VB 2005

Posted on 2009-05-13
4
454 Views
Last Modified: 2013-11-07
Hello,
I hope that you can help me...
I need to compare a single column recordset with the contents of a listviews subitems.
This has to return a true or false. I know that this can be done with a loop but I was hopeful of a cool trick or subroutine that would accomplish this...

Any Ideas?
0
Comment
Question by:fullbugg
  • 2
4 Comments
 
LVL 16

Accepted Solution

by:
Walter Ritzel earned 500 total points
ID: 24375468
If the type of data on the recordset and in the listview items are the same, you can use the Contains method on the Listview.Items. Example:

if (lvListView.Items.Contains(value from recordset))
{
  found it!!!1
}
0
 

Author Comment

by:fullbugg
ID: 24375571
Thanks for the reply... The "Value from recordset" is a string?
If so I am getting an error the string cannot be converted to a listviewitem.
0
 
LVL 16

Expert Comment

by:Walter Ritzel
ID: 24375753
I think I made a mistake....
instead of using a string directly, you need to create a listviewitem there, like this:
new ListViewItem("value from recordset")
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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

820 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