rishaan
asked on
Wait fn/sleep/delay
I need to create a delay of few seconds in my code.
Is there any efficient function to do that.
Is there any efficient function to do that.
ASKER
My application(service) is actually calling some other app and it has to wait till the other app takes on all the locks
So which one is good in my case??
Will thread.sleep etc cause any problem...I havent used threads...
So which one is good in my case??
Will thread.sleep etc cause any problem...I havent used threads...
>> it has to wait till the other app takes on all the locks
How do you know when this other app is done? Do you need to wait for it to close?
How do you know when this other app is done? Do you need to wait for it to close?
ASKER
no. I don't have to wait till it is done. But I have to give a delay to make sure the locks released by my app are taken by the other app.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Button1.Enabled = False
System.Threading.Thread.Sl
Button1.Enabled = True
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Button2.Enabled = False
Dim targetTime As DateTime = DateTime.Now().AddSeconds(
Dim ts As TimeSpan
Do
Application.DoEvents() ' keep application responsive
System.Threading.Thread.Sl
ts = targetTime.Subtract(DateTi
Loop While ts.TotalSeconds > 0
Button2.Enabled = True
End Sub