Not a Member Yet,
Click here to Register
How do you like the new design?






ID: 288
Viewed: 2689
Added: Jul 26, 2002
Version:
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:


code:-------------------------------------------
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
<!---Declaration--->
none

Highlight All
<!---Code--->
'code:---------------------------------------
Label1.Visible = True
DoEvents
Sleep 1000
Label1.Forecolor = RGB(255,0,128)
DoEvents
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 - 2017 snippetlibrary.com All Rights Reserved. Conditions