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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to make sure a form is being refreshed? 3

Status
Not open for further replies.

tjtindal

Programmer
Mar 22, 2004
66
US
Okay, I'm writing software that has a really long subroutine in it with countless do while/loop's in it. While it's looping, it's supposed to be refreshing the status bar at the bottom with the information that's going through it.

As long as you don't click away from the program while it's running, it'll continue doing it, however, if you click away, it'll stop. (It's still going, you're just not seeing any of it.) Then, if you click the program while that's happening, it'll report "Not Responding", even though it really is.

I've tried the following steps:

1. me.refresh
2. sbar.refresh (statusbar)
3. count to 50 and when you do, refresh both the status bar and the form and start over)
4. I'm so desperate, I've even tried:
me.visible = false
me.visible = true
me.refresh...even that doesn't work!

Is there any "fix all" solution anyone has to making the form refresh 'NO MATTER WHAT' even if it's not being paid attention to?
 
Try adding DoEvents within your major While loops. Depending on how you've designed your program to update the statusbar information, it will help that occur; otherwise, it will definitely keep the program responding as far as Windows is concerned.
 
Gotcha, "Do Event"...
What's a "Do Event" ? lol

Gotta say, never heard of it. I even looked in my "Visual Basic 6 Blue Book" and couldn't find anything on it. How exactly do I call a "Do Event" ?
 
At the end of your loop add the command "DoEvents" on its own line. This will pass control to the operating system temporarily to complete tasks (like updating the form).

____________________________________________________________________________
There are only 10 types of people in the world. Those that know binary and those that don't

Brent
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top