Search Tools Links Login

Add to a ListView control on the fly from a text datafile

This code will read in a two column data file (with the column titles in the first line) and update a listview control quickly and easily. It's easy to add more columns as needed. To use this code, you simply call the function like.
Call load_list_view_two(mylist, "c: est.dat")

Original Author: Blake Pell


Public Sub load_list_box_two(MyList As ListView, MyFile As String)
MyList.View = lvwReport
Open MyFile For Input As #1
  Input #1, one$, two$
  X = MyList.ColumnHeaders.Add(, , one$)
  X = MyList.ColumnHeaders.Add(, , two$)
  Do Until EOF(1)
    Input #1, one$, two$
    X = MyList.ListItems.Add(, , one$).ListSubItems.Add(, , two$)
Close #1
End Sub

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 93 times


Visual Basic 6


No attachments for this post

Loading Comments ...


No comments have been added for this post.

You must be logged in to make a comment.