Library code snippets
Displaying Recordsets in a ListView
Overview
This example demonstrates a quick and easy way to pass a Recordset to the ListView Control and format control's content using Data-Aware Classes. Most of applications use data that is created and consumed at run time. Some-times, this may be all that you need, but what if you need to store data between sessions, or utilize data that already exists outside of your program?
To work with external sources of data, you can make your class data-aware.
Simply setting the DataSourceBehavior to 1 (vbDataSource), your class can act
as a source of data for other objects.
A data source is a class that provides data from an external source to be consumed
by other objects. A Data control is actuality an instance of a class that is
a data source, but unlike the Data control, a data-aware class doesn't have to
have a visual representation, and it isn't limited to a particular data interface
such as DAO or RDO or ADO.
In fact, a data-aware class can act as a data source for any type of data, including traditional ODBC sources or any OLE DB provider, which makes much more powerful than a Data control.
Using such an approach it is very easy way to pass a Recordset to the ListView Control. Nice interface and behind the scenes actions for formatting any item in ListView: Bold / Italic / Regular Font Formatting for items; Color Formatting: every other row with any color; Icons in items on conditional formatting including Up/Down arrows for ascending / descending sort (put attention that sorting is correct, no matter that kind of data type it is).
Copy this code in, using the correct ADO refs and the correct ListView and
it should work like a charm. To some this may already be apparent, to others
perhaps not.
Related articles
Related discussion
-
Run-time error '91'
by converter2009 (1 replies)
-
VB6 Runtime error 381 subsript out of range Error
by Uncle (2 replies)
-
passing and reading parameters from using Shell
by jigartoliya (0 replies)
-
Convert C++ code to VB6
by mawcot (4 replies)
-
listbox scrollbar
by Dennijr (10 replies)
Related podcasts
-
Christian Beauclair
14 mai 2008 (�mission #0074) ::.Christian Beauclair: Stratégies de migration VB6 vers .NET Nous discutons avec Christian Beauclair des stratégies de migration VB6 vers .NET. Entre autres, nous discutons comment utiliser le "VB 6 Code Advisor" et le "Interop Forms Toolkit" pour ajouter la puiss...
hi,
any tutorial for this function?
This listview was quite useful but i can't understand the coding, so did u have any tutorial for this function?
thank u for reply
This thread is for discussions of Displaying Recordsets in a ListView.