0

Hi I have code as follows which works nicely but it loads a bit slow. I would like to have a progress bar while the file loads my code is as follows

  With OpenFileDialog1

        .Filter = "Text files (*.txt)|*.txt|" & "All files|*.*"
        .FileName = ""
        If .ShowDialog() = DialogResult.OK Then

            FileName = .FileName

            Dim Infile1 = New StreamReader(.OpenFile)

            For i = 0 To MainGrid.RowCount - 1
                For j = 0 To MainGrid.ColumnCount - 7
                    MainGrid.Rows(i).Cells(j).Value = Infile1.ReadLine()

                Next

               Next

            Infile1.ReadLine()


            Infile1.Close()



        End If



    End With
3
Contributors
2
Replies
3
Views
4 Years
Discussion Span
Last Post by tinstaafl
0

Also using accessing the streamreader through the file class and using .readalllines and iterating through the resulting array might be faster that reading the file one line at a time.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.