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:\test.dat")
Rate Add to a ListView control on the fly from a text datafile
(4(4 Vote))
Public Sub load_list_box_two(MyList As ListView, MyFile As String)
MyList.ListItems.Clear
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$)
Loop
Close #1
End Sub
Add to a ListView control on the fly from a text datafile Comments
No comments yet — be the first to post one!
Post a Comment