I have a C # WinForm application that I need to refresh every 5 minutes.
I have also seen the background worker as well as in the timer class.
I was wondering what is the best way to refresh primarily so that user updates can be displayed without shutting down and reopening the application.
called voting , you Step 1: You need to subscribe to the Note : If you get a timer control.
Timer Tick
event.
Step 2: Interval
timer
to 300000
milliseconds to increase the event for every 5 minutes Set the property. Step 3: in the Tick event handler
do whatever you want to do.
Step 4: You can call timer1.Stop ()
method whenever you want to stop the timer. stop
not timer
this becomes infinite
if you If you want to stop
to be the timer
you can timer1.Stop ();
can call on System.Windows .Forms.Timer timer1 = new system.windows.form. Timer (); Timer 1 Interval = 300000; // 5 minutes timer 1. Tick + = new system Aventahandler (Timer 1 post); Timer1.Start (); Private Zero Timer 1 Volt (Object Sender, EventArgse E): RefreshMeForm (whatever you like; } Private Zero Refresh MyForm () {// Update Form with Latest Data}
Comments
Post a Comment