|
-
Feb 11th, 2001, 05:41 PM
#1
Thread Starter
Hyperactive Member
Take look at this code:
Code:
Sub Misc1()
For i = 1 to 10
Call Misc2 (i)
Next i
End Sub
Sub Misc2(Num)
Do ...
...
Doevents
Loop
End Sub
When I call Misc2 with parametr i, the Do..Loop cycle is started and the Next i clause is called after exiting Misc2.
How to force the program to call Misc2 and continue doing what it should do (not waiting to subroutine end)?
-
Feb 11th, 2001, 05:46 PM
#2
Lively Member
try inserting DoEvents in Misc1's For Next loop.
-
Feb 11th, 2001, 05:54 PM
#3
Monday Morning Lunatic
That won't work -- the problem is that your program has only one thread.
In a thread, only one thing happens at once, so execution of your program passes from one sub to another, completing everything on the way.
In order to do what you want you need to create another thread, but it's very iffy in VB. However, you can just-about simulate it by using an ActiveX DLL that's external to your program.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Feb 12th, 2001, 06:26 PM
#4
Fanatic Member
Do it like this.....
Code:
Sub Misc1()
For i = 1 to 10
Call Misc2 (i)
Next i
End Sub
Sub Misc2(Num)
Do
DoEvents
Loop Until DoEvents
End Sub
DocZaf
{;->
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
|