[2005] Form display question
I have a vb.net 2005 app that cycles through a list of records and inserts them into the database. It works great, but I'm having trouble displaying the results. I have a textbox that gets updated after each iteration:
txtResult.text = vbCrLf & accountid & " : " & strResult
The processing is executed on a button click. The problem is the textbox does not display until after the entire process is finished running, then 500 lines are displayed at once.
Is there any way to force a redraw of the form, or even just a single control (the textbox) on the form? Also why is this happening?
Re: [2005] Form display question
You can try txtResult.Refresh() after each update.
This typically happens during CPU intensive operations, the main GUI thread gets little allocation of CPU s the form does not get updated very often and sometimes not at all. A way out of this is to put a CPU intensive operation into its own thread. There are many examples of threading in previous posts on this forum.
Re: [2005] Form display question
Thanks, it worked. I do an txtResult.Refresh every [ count MOD 50 = 0 ] so it updates periodically and the refresh doesn't try to comandeer too many resources.
Re: [2005] Form display question
Excellent!
Mark the thread resolved if the issue is closed.