Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Compare Dataset with Listview Items VB 2005

Posted on 2009-05-13
4
Medium Priority
?
460 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 2000 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
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…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
Suggested Courses

886 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