0

To freeze the exicution for specified period we use threading.thread.sleep() in timer tick event.....
But my problem is how to freeze the exicution of a button clivk event for a specified time.....??
I jst tried to use threading.thread.sleep()
But its not working in button click event

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by vbDotMe
0

Not sure exactly what you are trying to do but using System.Threading.Thread.Sleep(X) will freeze the entire application until the timer is up. Try this:

Sub Wait(byval X as integer)
    Dim sTime = Now
    Dim eTime = sTime.AddSeconds(X)
    Do Until Now = eTime
    Loop
End Sub

Using that method your application will wait the specified time without freezing your app to do so. To use it just add Wait(5) to wait 5 seconds.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.