realtime Scrolling textbox isnt realtime

Beat-Down

Newcomer
Joined
Sep 19, 2003
Messages
9
I have a program that reads a list of files, opens each file and extracts the data. What I want the program to do is read the file and dump its contents into a textbox so the user can watch it work and look for errors. But I want to text in the textbox to be updated realtime and not in a large lump sum at the end whenever the loop finishes.

any Ideas? Thanks in advance

Here is the code

Dim i As Integer
Dim FileData As String

Dim Path As String = txtPath.Text
FileListArray = System.IO.Directory.GetFiles(Path & "\", "*.txt")
lstDisplay.Items.Clear()
If FileListArray.Length > 0 Then ProgressBar.Maximum = UBound(FileListArray)
ProgressBar.Minimum = 0
ProgressBar.Value = 0
For i = 0 To UBound(FileListArray)
lstDisplay.Items.Add(FileListArray(i))
lstDisplay.SelectedIndex = i
ProgressBar.Value = i

'Open File
sr = New StreamReader(FileListArray(i))
'Read File Contents
FileData = sr.ReadToEnd
'Parse File
txtDisplay.Text = txtDisplay.Text & FileData & vbCrLf
txtDisplay.SelectionStart = Len(txtDisplay.Text)

'Close File
sr.Close()

Next
 
Back
Top