Results 1 to 6 of 6

Thread: Noobie Question

Hybrid View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2002
    Posts
    142

    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

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    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.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2002
    Posts
    142

    Thanks for the reply....

    Thanks for that info

    Do you have any information on threading?
    I am doing a project where speed really counts, so alot of things I never worried about before, I am worrying about now

    Thanks,
    bebandit

  4. #4
    Frenzied Member Memnoch1207's Avatar
    Join Date
    Feb 2002
    Location
    DUH, Guess...Hint: It's really hot!
    Posts
    1,861
    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

  5. #5
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Which method you use depends on if the sub takes parameters or not but here is the basic concept:
    VB Code:
    1. Sub Isitdoneyet
    2.  
    3. dim t as New Threading.Thread(AddressOf doit)
    4. t.Start()'calls method on its own thread
    5.  
    6. 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.

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    May 2002
    Posts
    142

    CHEERS..

    THANKS FOR ALL THE INPUT...



    I LOVE THIS FORUM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width