Hi guys, I am trying to implement a BGW and want to report progress to a progress bar for my TextFieldParser program, sometimes if your opening very large files it takes a while and I would like the user to be able to see the progress and have some interaction so they know the program is still running

I am a little hung up on what to in the reportprogress

I have:

worker.ReportProgress(0, myReader.ReadFields())

and its not doing anything, I didnt expect it too since ReadFields is an array

any suggestions or help would be appreciated here is the code for my TextFieldParser

parser Code:
  1. Private Sub BackgroundWorker1_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
  2.         Dim worker As System.ComponentModel.BackgroundWorker = DirectCast(sender, System.ComponentModel.BackgroundWorker)
  3.  
  4.         Dim safeFileName As String = Me.OpenFileDialog1.FileName
  5.         Using myReader As New Microsoft.VisualBasic.FileIO.TextFieldParser(safeFileName)
  6.             myReader.SetDelimiters(vbTab)
  7.             Dim currentRow As String()
  8.             currentRow = myReader.ReadFields()
  9.             Dim colNameList As New List(Of String)
  10.             Dim colName As String = String.Empty
  11.  
  12.             For i As Integer = 0 To currentRow.GetUpperBound(0)
  13.  
  14.                 colName = currentRow(i)
  15.                 Dim suffix As Integer = 1
  16.                 While colNameList.Contains(colName)
  17.                     colName = currentRow(i) & suffix.ToString
  18.                     suffix += 1
  19.                 End While
  20.                 colNameList.Add(colName)
  21.  
  22.             Next
  23.             For Each currentField As String In colNameList
  24.                 table.Columns.Add(currentField, GetType(System.String))
  25.  
  26.             Next
  27.             While Not myReader.EndOfData
  28.                 Try
  29.                     currentRow = myReader.ReadFields()
  30.                     table.Rows.Add(currentRow)
  31.                     worker.ReportProgress(0, myReader.ReadFields())
  32.                 Catch ex As Exception
  33.                 End Try
  34.             End While
  35.         End Using
  36.         If table.Columns.Contains("Column1") Then
  37.             table.Columns.Remove("Column1")
  38.         End If
  39.         dtAll = table
  40.     End Sub