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
Re: When need "DoEvents" and/or "Sleep"
no need for this code
read this to know abt DoEvents
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"
Re: When need "DoEvents" and/or "Sleep"
link may be useful for u.
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.
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
Re: When need "DoEvents" and/or "Sleep"
Quote:
Originally Posted by
Spoo
That is a very common method but it's a CPU hog. The WaitMessage API is the opposite.
Re: When need "DoEvents" and/or "Sleep"
CDrive
Good to know. Thanks for info.
Spoo