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:
  1. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  2.         Using MyReader As New Microsoft.VisualBasic.FileIO.TextFieldParser("STFRWSAL.REP")
  3.  
  4.             MyReader.TextFieldType = FileIO.FieldType.Delimited
  5.  
  6.             MyReader.SetDelimiters(",")
  7.  
  8.             Dim currentRow As String()
  9.  
  10.             While Not MyReader.EndOfData
  11.                 currentRow = MyReader.ReadFields()
  12.                 Dim item As ListViewItem
  13.                 item = ListView1.Items.Add(currentRow(0))
  14.                 Dim ix%
  15.                 For ix = 1 To UBound(currentRow)
  16.                     item.SubItems.Add(currentRow(ix))
  17.                 Next
  18.             End While
  19.         End Using
  20.     End Sub

I am new to VB so any suggestions or help would be greatly appreciated.