Not a Member Yet,
Click here to Register

ID: 288
Viewed: 3264
Added: Jul 26, 2002
Snippet uploaded by: snippet
Written By: unknown
Demo: Sorry, no demo

User Rated at: 0 Stars
Rate This:

Thank you for your vote. Please wait...

It appears you already voted for this snippet

It appears your vote value was empty

Using the Sleep API call pauses your entire application. It pauses EVERYTHING in your entire application. This means that if you have something like this:

Label1.Visible = True
Sleep 1000
Label1.Forecolor = RGB(255,0,128)
Sleep 1000
You'd think Label1 would appear, wait one second, and then turn purple, right? Wrong. All you'd see is nothing for a delay of two seconds, and then LAbel1 would pop up, both visible and purple. Y'see, Label1 would become visible as far as the code is concerened, but not on the screen. The Sleep call jumps right in there and pauses everything without waiting for a screen refresh. That's what the DoEvents is for. It doesn't make the Sleep call any more accurate, but it makes the results visible. Thus:

Highlight all by clicking in box

Highlight All
Label1.Visible = True
Sleep 1000
Label1.Forecolor = RGB(255,0,128)
Sleep 1000
'This would give you the desired result, Label1 appearing, 'waiting one second, and turning purple.

No Comments to show

Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.

Replying to a Comment...

Adding your comment. Please wait...

Thanks for adding your comment!. After further review it will be added.

There was a problem adding your comment. Please try again.

Please complete all the fields in the form before sending.

© 2002 - 2024 All Rights Reserved. Conditions
Do NOT follow this link or you will be banned from the site!