|
-
Dec 17th, 2003, 12:35 PM
#1
Thread Starter
Addicted Member
Noobie Question
I am not a noobie, but feel like one asking this question.....
If I call a function in a sub, does the function need to complete before it finishes the sub? I want to call a function, but not wait for the function to finish before finishing the sub. The function does not return any values.
Sub Isitdoneyet
call function doit
<-- I want the next lines to finish without waiting for the function doit to finish -->
do more things..
end sub
Thanks,
Bebandit
-
Dec 17th, 2003, 12:46 PM
#2
Yes it will finish the sub you called before continuing on in the current sub. If you really don't want to wait then you'll need to use threading or a delegate.
-
Dec 17th, 2003, 12:52 PM
#3
Thread Starter
Addicted Member
-
Dec 17th, 2003, 12:55 PM
#4
Frenzied Member
If it doesn't return any value then it should be a Sub instead of a Function.
But, Edneeis is correct...it will process the called Sub (Function) before continuing on inside the calling Sub...unless you have it operate within its own thread.
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
-
Dec 17th, 2003, 01:12 PM
#5
Which method you use depends on if the sub takes parameters or not but here is the basic concept:
VB Code:
Sub Isitdoneyet
dim t as New Threading.Thread(AddressOf doit)
t.Start()'calls method on its own thread
end sub
There are also issues with resources and threads so you may want to read up on threading in the help files. For information on using a delegate search the forums or help for BeginInvoke.
-
Dec 17th, 2003, 01:32 PM
#6
Thread Starter
Addicted Member
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
|