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

So...have you looked into the documentation for the ProgressBar control?

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.