Solved

Compare Dataset with Listview Items VB 2005

Posted on 2009-05-13
4
453 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

774 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