PNRT
asked on
VB,Net, fast updating on textbox
Hi Experts
VB.Net 4
I have a queue to which I am adding +- 5000 strings on a separate thread
To Speed things up, while these strings are being added, I am taking the strings from the queue and adding them to a textbox, fired from a timer on the main thread.
If I use -
If SelectedFilesQueue.Count <> 0 Then
TextBox1.AppendText(Select edFilesQue ue.Dequeue .ToString & vbCrLf)
End if
It works well but is VERY slow to complete
If I use -
While SelectedFilesQueue.Count <> 0
TextBox1.AppendText(Select edFilesQue ue.Dequeue .ToString & vbCrLf)
End While
This is fast, takes a quarter of the time, but it freezes my GUI.
If I try and add the second example to a separate thread, I still have the problem of updating the GUI from that thread
Anyone know how to keep the speed but stop the GUI from freezing?
Thanks in advance
VB.Net 4
I have a queue to which I am adding +- 5000 strings on a separate thread
To Speed things up, while these strings are being added, I am taking the strings from the queue and adding them to a textbox, fired from a timer on the main thread.
If I use -
If SelectedFilesQueue.Count <> 0 Then
TextBox1.AppendText(Select
End if
It works well but is VERY slow to complete
If I use -
While SelectedFilesQueue.Count <> 0
TextBox1.AppendText(Select
End While
This is fast, takes a quarter of the time, but it freezes my GUI.
If I try and add the second example to a separate thread, I still have the problem of updating the GUI from that thread
Anyone know how to keep the speed but stop the GUI from freezing?
Thanks in advance
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Application.DoEvents()