Hello,
I am trying to figure out how to dynamically populate a listview with data from a file, except I only want specific lines and columns from that file. I have code right now that works to populate the listview from the file, but it writes the whole file and I only want specific lines and columns. Here is the code I currently have to populate the listview when the form loads:
VB 2010 Express Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Using MyReader As New Microsoft.VisualBasic.FileIO.TextFieldParser("STFRWSAL.REP") MyReader.TextFieldType = FileIO.FieldType.Delimited MyReader.SetDelimiters(",") Dim currentRow As String() While Not MyReader.EndOfData currentRow = MyReader.ReadFields() Dim item As ListViewItem item = ListView1.Items.Add(currentRow(0)) Dim ix% For ix = 1 To UBound(currentRow) item.SubItems.Add(currentRow(ix)) Next End While End Using End Sub
I am new to VB so any suggestions or help would be greatly appreciated.




Reply With Quote