Solved

Compare Dataset with Listview Items VB 2005

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

Accepted Solution

by:
Walter Ritzel earned 500 total points
Comment Utility
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
Comment Utility
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 15

Expert Comment

by:Walter Ritzel
Comment Utility
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

743 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

16 Experts available now in Live!

Get 1:1 Help Now