how to put a data in the listview? using adodb.recordset :)

Hi
Change ListView.View to Report
Add Columns as per the recordset columns
Use ListView.ListItems.Add() method to add an item to ListView. It will return a ListItem object. Then use that object to add subitems

Ex

Dim oListItem    As ListItem

   ' Create two columns
   ListView1.ColumnHeaders.Add , , "First"
   ListView1.ColumnHeaders.Add , , "Second"
   ' Create a row
   Set oListItem = ListView1.ListItems.Add(, , "First Column")
   ' Add sub items
   oListItem.SubItems(1) = "Second Column"

Iterate thru all the records and show it in ListView

in the first column what should i put? example i want to put a data in my access how can i do that?

In the first column u should put the data from the recordset's first column. I have given the sample code only

To do

Open the Database Connection
Open the Recordset
Move to the first record

Do While Not Recordset.EOF
' Here populate the listview from recordset
'Ex Set oListItem = ListView1.ListItems.Add(, , Recordset.Fields("FieldName"))

Move to next record
Loop

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.