Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

a delay in visual basic

  • 22-04-2004 4:10pm
    #1
    Registered Users, Registered Users 2 Posts: 1,285 ✭✭✭


    I am programming an IC tester in visual basic for a college project. It works fine except it runs the tests too fast. I was wondering if there is a simple way to pause or delay the program for a second or 2 before performing the next line of code. I'm not great at programming using visual basic so an explanation in the simplest form would be appreciated.

    Cheers

    eoinf


Comments

  • Registered Users, Registered Users 2 Posts: 2,426 ✭✭✭ressem


    http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20843293.html

    Look at sleep and delay routines.
    Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    

    Use with
    Sleep (3000)  '// Will pause for 3 seconds
    

    Problem is that this will freeze other events, so the "delay" routine, listed at the link above,
    1 calls sleep for a fraction of a second,
    2 calls doevent to make the interface respond to the user, and
    if time spent is less than the specified number of seconds go to 1


  • Registered Users, Registered Users 2 Posts: 1,285 ✭✭✭eoinf


    i keep getting errors

    where do i put the first line of code

    Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)


  • Registered Users, Registered Users 2 Posts: 21,264 ✭✭✭✭Hobbes


    unless VB has changed that radically you shouldn't need the declare statement. VB should have a sleep command built in.


  • Registered Users, Registered Users 2 Posts: 629 ✭✭✭str8_away


    Originally posted by eoinf
    i keep getting errors

    where do i put the first line of code

    Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

    with VB6 (not sure about other versions

    if you are putting the declaration in a module then you not need to change.

    if you are putting the declaration at the top of you code where you put global variable make the declare private.
    Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)


Advertisement