|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
countdown timerHi everyone....
I'm trying to make something work... When I launch a new form, the application has to quit after a few seconds... I searched the net for some hours and I can't find any usefull code ... I noticed there are several timers in .net... Which one do I use ? Thanx John Hi,
If you're using Windows Forms, use a System.Windows.Forms.Timer. Put the timer on your form and attach to the Timer.Tick event. When the event fires, call Application.Quit(). You can use System.Threading.Timer if you want, but this uses Windows resources. The System.Timers.Timer class is more for server-based timers that need better accuracy and ability to move between threads. Regards, -Adam. John Devlon wrote: Show quoteHide quote > Hi everyone.... > > I'm trying to make something work... > > When I launch a new form, the application has to quit after a few seconds... > > I searched the net for some hours and I can't find any usefull code ... > I noticed there are several timers in .net... > Which one do I use ? > > Thanx > > John > > Thanx Adam, It works great....
Below the code for other people who need it ... Private Sub quit_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Timer.Start() End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer.Tick Application.Exit() End Sub John Show quoteHide quote "Adam Goossens" <adam.gooss***@gmail.com> schreef in bericht news:uNMeAOkQFHA.2136@TK2MSFTNGP14.phx.gbl... > Hi, > > If you're using Windows Forms, use a System.Windows.Forms.Timer. Put the > timer on your form and attach to the Timer.Tick event. When the event > fires, call Application.Quit(). > > You can use System.Threading.Timer if you want, but this uses Windows > resources. The System.Timers.Timer class is more for server-based timers > that need better accuracy and ability to move between threads. > > Regards, > -Adam. > > John Devlon wrote: >> Hi everyone.... >> >> I'm trying to make something work... >> >> When I launch a new form, the application has to quit after a few >> seconds... >> >> I searched the net for some hours and I can't find any usefull code ... >> I noticed there are several timers in .net... >> Which one do I use ? >> >> Thanx >> >> John
Determine if "Hide extensions for known file types" is active
Need help updating table What scope is best for defining Enum type? VB6 to VB.Net Conversion How to overload method of third party component? creating an array as property of a class Selecting specific columns from a dataview? StringBuilder size question? Limiting the directories somebody can browse to..... Passing parameters to Data Adapter |
|||||||||||||||||||||||