Advertisement
C_Volume2 Miscellaneous #73576

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")

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
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
Original Comments (3)
Recovered from Wayback Machine