Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Event: wait several seconds

Status
Not open for further replies.

uticket

IS-IT--Management
Joined
Jun 1, 2004
Messages
37
Location
US
Is there any function in .net that will hold the program execution for several seconds, like we use sleep or wait in C/Unix.

.net does have sleep or wait function, but it seems they involves threads.

What I want to do is just to wait 5 seconds, then close the form if the user does not do that. But I hope I do not have to put a timer on the form. I just want a simpler command.

Any hints will be appreciated.

Thanks!
 
In multithreadhing you should avoid Thread.Sleep() or Thread.SpinWait().
Only Thread.Sleep(0) is acceptable optimization technique to force a context switch.
Thread.Sleep(int) is acceptable in testing or simulation code.
Use Monitor.Wait(object o, int millisec).
-obislavu-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top