Hi
I wondered if there is a code that does this
private function getexit()
'code thats let the app wait till the 5 sec are over
close()
end function
So the app have to close after 5 sec
can someone help me with this?
Printable View
Hi
I wondered if there is a code that does this
private function getexit()
'code thats let the app wait till the 5 sec are over
close()
end function
So the app have to close after 5 sec
can someone help me with this?
to suspend execution for 5 seconds
vb Code:
threading.thread.sleep(5000)
Works great. I was kind of wondering what would be the .NET replacement for the Sleep APIQuote:
Originally Posted by .paul.
vb.net Code:
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing Threading.Thread.Sleep(5000) End Sub
You could add a timer, set the interfal to 5000, then exit the program on the tick event. That would keep from shutting down the UI.
Why would anyone want to sleep the main thread for 5 full seconds?:eek:
I was thinking the exact same thing. I don't think I've ever heard of a good reason for sleeping the UI thread before. Usually the programmer is designing something the wrong way.
Actually, after rereading the original poster's question, it seems apparent that he doesn't actually want to sleep the original thread, just to exit 5 seconds after the event is called. Because of this, I don't think sleeping or halting any threads at all, be it of the UI or worker.
The way I would do it would be to use Shaggy's solution. Sure, the Timer is only run once, but I believe it encapsulates such behavior very well.
the thing is that the app i made scans files in a client folder and if the files are modyfided the app delete those files and download fresh ones from the web but the scan and replace goes so fast that users cant see the log cuz the app ends after scan event cuz the game starts then. now users got the time to read
Why can you not just let the user click a button to have the game launched at the end instead of launching it automatically? Then the user would have as much time to read as he'd need. OR you could activate a timer with a tick of 10 seconds, instead of launching the game. When the timer has raised the tick event, launch the game.
If I where to have an application that became unresponsive for longer period of times, Id get really annoyed. If someone then told me that it is actually programmed to do so, I'd uninstall it right away.