Results 1 to 4 of 4

Thread: Sleeping a sub (not the entire program!)

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 1999
    Location
    Leeds, UK
    Posts
    287
    Hi,

    I'm sure you all know the Sleep API? I would like to make a sub Sleep and not the whole program! If you have seen the Sleep API before you will be aware that it puts the entire program to rest even restricting you from moving the form around the screen with the title bar until the sleep time is up. Is there a way to just sleep a sub (without using a loop)?

    Thanks

  2. #2
    Hyperactive Member
    Join Date
    Sep 1999
    Location
    Cleveland, Ohio
    Posts
    263
    Simple. Don't use sleep. Either tell the code to stop executing and restart under certain circumstances, or:
    Code:
    While X <> 10
    DoEvents
    Loop
    'Nothing happens till X = 10

  3. #3
    Addicted Member
    Join Date
    Feb 2000
    Location
    CWMBRAN,WALES,UK
    Posts
    146
    Have a look at a tip by James Wilson
    "How to delay a VB program without using the API"

    URL: http://www.vb-world.net/misc/tip82.html

    Hope this helps

    GRAHAM

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221

    Another way



    if continue then goto cont
    .
    .
    continue=true
    exit sub
    cont:
    .
    .
    continue=false
    end sub

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