View Single Post
  #4 (permalink)  
Old March 18th, 2008, 10:56 AM
BrianWren BrianWren is offline
Friend of Wrox
Join Date: Nov 2004
Location: Port Orchard, WA, USA.
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts

There are several things a form needs to do to be fully loaded and displayed. Most of those things raise events (Load, Activate, Resize, etc.)

You often can have one of these events change the value of a variable that some other process checks before running, thereby being able to cause it to "wait."

But since your routine takes so long to run, it seems that the form should be able to get its act together while the routine is running.

Many types of action tie up the processor, so that the screen effectively "freezes" until the action is done. In VB6 the way to overcome that is to add DoEvents to the routine. This is an explicit command to release the processor to service pending lower-priority acttions (like updating the screen).

In .NET use Application.DoEvents().

So what you would do is run the components in the order you indicated above. In routine 1, upon entry run DoEvents, and if yo uhave a loop in the routine put a DoEvents where it will run regularly. If no loop, sprinkle DoEvents throughout the routine.

BTW, it’s sep[u]a</u>rate, not sep[u]e</u>rate...
Reply With Quote