how can I make the program wait?

I am writing a program that is talking to different types of hardware. I need to make the program wait 1 second before making the call to talk to a different piece of equipment, but I'm not sure how to do that. I initially put in a timer that it called, but when it called the timer function, it kept going through the sub routine and made the equipment call at the same time. How can I fix this?


  • Add this to a VB form for example ...

    Option Explicit

    Private Declare Function GetTickCount Lib "kernel32" () As Long

    Sub Wait(numSeconds As Long)
    Dim start As Long
    start = GetTickCount() + (numSeconds * 1000)

    Do While start > GetTickCount()
    End Sub

    If you want the code to wait a second ...

    Wait 1
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion