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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to hold the program execution for several seconds

Status
Not open for further replies.

uticket

IS-IT--Management
Jun 1, 2004
37
US
Hi, 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!
 
uticket,
The command
Code:
System.Threading.Thread.Sleep(5000)
should make the current thread (the form it is placed in) sleep for five seconds.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top