refresh control content while processing data

Jul 23 2009 6:45 PM
Hi,
I have a form with a button which starts processing different operations on a large number of records.
I created a panel with a label and progressbar inside of it, to use for a feedback to the user.

when they use clicks the button, I change the panel's visibility to visible and set the label's content to the first operation's name. the progressbar is incremented until the operation is done.
When an operation is done and a new one starts, I reset the progressbar and change the label's text to the name of the second operation, and so forth.

the problem I am having is that the processing of the data (loop, read, update, etc.) is taking precedence over the painting of the panel and it starts before even the panel is displayed. so all the user can see is the progressbar floating by itself without a panel or the label.
when all operations are done, the panel finally appears with the label containing the name of the last operation.
 
I want the panel and the label also to appear and reflect the operation name while it's being processed and not after.
is there a way to do that? maybe doing the display in a separate thread?

Thank you in advance

George


Answers (1)