Results 1 to 2 of 2

Thread: How to display some selected data from db in a listview?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2000
    Posts
    20

    Post

    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 :þ

  2. #2
    Addicted Member
    Join Date
    Oct 1999
    Posts
    253
    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!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width