The only "wait" function I know of is 'system.threading.thread.sleep'. However, this will hang the UI if you call it on the main thread. So unless your using multiple threads and this code is running on non UI thread I wouldn't use it. If your code is running on the UI thread you have two options that I can think of. Try to re-work your code and instead use a timer to fire off the desired code at the right time, or create your own wait function.
' Loops for a specificied period of time (milliseconds)
Private Sub wait(ByVal interval As Integer)
Dim sw As New Stopwatch
sw.Start()
Do While sw.ElapsedMilliseconds < interval
' Allows UI to remain responsive
Application.DoEvents()
Loop
sw.Stop()
End Sub
Enter your message below
Sign in or Join us (it's free).