Window for indicating a process in working.

Dycker

Member
Joined
Oct 14, 2004
Messages
6
Programming Experience
10+
Hello,

I am sure there is something here to help me but I'm not sure what to look for so please forgive me if it's here and I haven't found it. Please point me in the right direction.

I have a form in which the user will make some choices and then the program will have to perform an operation. This operation may take anywhere from 5 seconds to a minute. I want to display a form (that I could then use from other forms) that shows a message indicating that the operation is in progress. I can't show a percent complete but would just like to give the user an indication that the program is indeed working.

I have created a form in which I pass a string, then show the form before the operation starts. After the operation I close the window. The problem is, in my message form I set a label with the string passed but the label never gets filled in. The message form appears, the operation progress but the string I put in the label doesn't show.

Am I approching this incorrectly?

Thanks for any help.
Gerry D.
 
The problem is that you are only using a single thread and it is so busy performing your operation that it doesn't have a chance to refresh the UI. If you want to force a refresh before starting the operation then just call the form or control's Refresh method. Having said that, if your app needs its UI redrawn at any point during the operation it will just go blank because, again, the thread is too busy to do it.
 
This sounds as a typical use of Application.DoEvents. "If you call DoEvents in your code, your application can handle the other events." Do not misuse this as it cause other processing in application to pause. Read the documentation topic on this.
 
Back
Top