|
-
Jun 17th, 2011, 10:06 PM
#1
Thread Starter
Hyperactive Member
When need "DoEvents" and/or "Sleep"
I have question:
When need "DoEvents" or "Sleep"
any advice if this example, need "DoEvents" ?
Code:
Private Sub Command1_Click()
Dim a As Integer
Dim b As Integer
Dim c As Integer
Dim d As Integer
a = 6
b = 7
c = a + b
DoEvents
d = c * c
DoEvents
MsgBox d
End Sub
-
Jun 17th, 2011, 10:10 PM
#2
Re: When need "DoEvents" and/or "Sleep"
no need for this code
read this to know abt DoEvents
-
Jun 17th, 2011, 10:18 PM
#3
Thread Starter
Hyperactive Member
Re: When need "DoEvents" and/or "Sleep"
I was read. but general , open/read/write file. database ado connect. use some OCX (WebBrowser1" that
need "DoEvents" no else ?
Also, "DoEvents" is avaible set TIMEOUT ?
if WebBrowser1 no any response after 60sec,
open/read/write file/database too large, over 100MB, and still use 60sec
kill it, msgbox "error"
-
Jun 17th, 2011, 10:44 PM
#4
Re: When need "DoEvents" and/or "Sleep"
link may be useful for u.
-
Jun 18th, 2011, 10:54 AM
#5
Re: When need "DoEvents" and/or "Sleep"
Not sure what you're asking but the purpose of DoEvents is not to create a pause/delay. If you're looking for a method of inserting a pause the Sleep API (as a stand alone function) sucks. Without additional code, Sleep will make your app comatose.
The WaitMessage API is a far better choice. It --needs DoEvents to function though.
Last edited by CDRIVE; Jun 18th, 2011 at 11:01 AM.
Reason: fool annoying advertising link
<--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
If topic has been resolved, please pull down the Thread Tools & mark it Resolved.
Is VB consuming your life, and is that a bad thing?? 
-
Jun 18th, 2011, 01:30 PM
#6
Re: When need "DoEvents" and/or "Sleep"
Rpool
If you truly want a "sleep" or "wait", as an alternative to CDrive's
suggestion, check out RhinoBull's snippet in this thread (post #2):
http://www.vbforums.com/showthread.php?t=652682
Spoo
-
Jun 18th, 2011, 05:55 PM
#7
Re: When need "DoEvents" and/or "Sleep"
 Originally Posted by Spoo
That is a very common method but it's a CPU hog. The WaitMessage API is the opposite.
<--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
If topic has been resolved, please pull down the Thread Tools & mark it Resolved.
Is VB consuming your life, and is that a bad thing?? 
-
Jun 18th, 2011, 06:05 PM
#8
Re: When need "DoEvents" and/or "Sleep"
CDrive
Good to know. Thanks for info.
Spoo
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
|