Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refreshing GUI when application regains focus

Status
Not open for further replies.

jed79

Programmer
Jul 30, 2002
13
0
0
US
I have an MDI application. I have one process that takes about two minutes to complete. When I start this process and switch to another application (email, explorer, etc), and then switch back to my app, all I get is a white screen until the process completes. I'm trying to add a progress bar to let the user know what's going on, but that doesn't refresh either until the two minute process completes.

What am I doing wrong? I thought it was a modality issue, but I'm not sure. I resolved this sames issue in vb 6.0, but know i'm working in vb.net.

Thanks for your support.
 
run that process on a different thread. Look at the Threading namespace
 
I don't know if it would help here or not, but you could try adding a "DoEvents" (which, IIRC, is part of the Application namespace now) in your loop. This should allow for screen refreshes, etc. to take place periodically.

For x = 1 to 100
'Code to do stuff (Including updating Progress Bar)
Application.DoEvents()
Next

That might get you closer to what you want without having to do any threading.

Ben

There's no place like 127.0.0.1.
 
That may work, but you are still holding up the user in that application for the two minutes processing time.
 
Woyler is right, the best way is as he suggested kick of your process in a thread and set it's IsBackGround to TRUE, this way even your progress bar will refresh and at any point when the user clicks back on your app from any other app, it will immediatly gain the focus.

-Kris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top