PDA

Click to See Complete Forum and Search --> : How to display some selected data from db in a listview?


hcleo
Mar 14th, 2000, 09:00 AM
First i have create some headers, but i have problem when i want to put some data from a db to the column i want, especially the first column. Could anyone show me how? ThanX :þ

Forest Dragon
Mar 16th, 2000, 05:45 PM
Example (suppose you are working with ADO):

Dim RecSet As ADODB.Recordset,Counter As Integer

'After opening connection and recordset
RecSet.MoveFirst
For Counter=1 To RecSet.RecordCount
ListView1.ListItems.Add ,,RecSet("Field1").Value
ListView1.SubItems(1)=RecSet("Field2").Value
'and so on...
RecSet.MoveNext
Next Counter

Note that if the type of the field you need to put in the ListView is not Text, you need to turn the data to a string before adding it to the ListView.

Good Luck!!!