|
-
Mar 27th, 2001, 01:24 PM
#1
Thread Starter
Hyperactive Member
I have some rather long Do...Loop's in my program.....I have put the DoEvents command inside some of the longer loops, and my program is starting faster and there are no visual screen problems with repainting now.
My question is:
Is there any negative effect of the DoEvents command or using too many DoEvents commands??
Please advise.
Thanks!!!
"If I had known it was going to be that kinda party, I would have stuck my disk in the mash potatos!"
-
Mar 27th, 2001, 01:27 PM
#2
The only negative effect there is is that your program runs slower, because it gives the OS time to repaint the screen and do whetever it needs to do.
You must be careful though, it is possible to close a form that's running a loop with doevents... possibly crashing the program.
You can get around that by setting some variable when the loop runs and check that var when the user wants to close the form, and do not allow it to unload. Or stop the loop and then unload.
Gerco.
-
Mar 27th, 2001, 01:34 PM
#3
Thread Starter
Hyperactive Member
I see.
The reason I added the DoEvents is because when the program was in the loop, which is a SUB in a MODULE, the screen was showing large white blocks for some of the controls....and it was taking a long time after issuing the command.
After adding the: openforms = DoEvents
the program started with lighting speed and I had no white spaces.
Is this practice ok??
P.S. Thanks for the info.
"If I had known it was going to be that kinda party, I would have stuck my disk in the mash potatos!"
-
Mar 27th, 2001, 01:34 PM
#4
you can also test the actual DOEvents in the loop
if DoEvents = 0 then exit loop
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Mar 27th, 2001, 01:41 PM
#5
Sure you can do that... the white blocks are because the OS doesn';t have time to paint your program's window.
To allow the OS some time, use DoEvents.
Gerco.
-
Mar 27th, 2001, 01:44 PM
#6
Thread Starter
Hyperactive Member
Thanks again!
Your help is extremely appreciated!!!!
"If I had known it was going to be that kinda party, I would have stuck my disk in the mash potatos!"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|