Home > Net >  C # the Timer Timer.
C # the Timer Timer.

Time:09-27

C #, how to use the timer every day fixed time to execute
To refresh the list

CodePudding user response:

The timer interval to 1 minute, check whether the current time to trigger time set the time, if it is, just refresh list of function
Private void Form1_Load (object sender, EventArgs e)
{
System. The Timers. The Timer Timer=new System. Timers. The Timer ();
The timer. The Interval=60000;
The timer. Elapsed +=Timer_Elapsed1;
}

Private void Timer_Elapsed1 (object sender, System. Timers. The ElapsedEventArgs e)
{
If (DateTime. Now. ToString (" yyyy - MM - dd HH: MM)==PreSetDateTime)
{
RefreshList ();
}
}

CodePudding user response:

See also: http://www.cnblogs.com/yang-fei/p/6169089.html

CodePudding user response:

Now that you are a day,
It should be a service, not just the Timer Timer, the
https://blog.csdn.net/hanjun0612/article/details/78283017

CodePudding user response:

You can refer to the https://blog.csdn.net/x2570799116/article/details/78860448

CodePudding user response:

Regular homework

CodePudding user response:

Do a Windows service, in service timer timing is carried out
  •  Tags:  
  • C#
  • Related