Search code examples
vb.netbackgroundworkersleepintervalstime-wait

Sleep but with interval update


I am using Visual Basic.net with a BackGround Worker. I am wanting to wait for x milliseconds but to update a Label with the current wait value.

How can I do this?

I am using this code at the moment:

Threading.Thread.Sleep(5000)

What else can I use as the above code does not inform me of the sleep progress?


Solution

  • Im not sure what you mean, but here is a similar code to yours. Hope it helps!

    Dim EndTime As DateTime = DateTime.Now.AddSeconds(TimeToWaitInSeconds)
    While DateTime.Now < EndTime
        Application.DoEvents()
    End While