C # The winform program regularly executes a function-regularly checks for updates

Source: Internet
Author: User

Timer control is required

Timer1.interval

Events triggered when timer1.tick reaches the time interval

Test_tick time processing function

Timer1.tick + = new system. eventhandler (test_tick );
Delegate to process events. Generally, you can add the above Code to the component function of the form constructor initializecomponent constructor interface to register the test_tick handler function;

Of course, you don't have to worry about this. Double-click the timer control in the form view, and the system will automatically generate a processing function similar to test_tick.

Generally, you need to use timer1.start (); // start the timer timer1.stop ();. // disable the timer method.

The general code process is as follows:

Private void form_load (Object sender, eventargs e) {timer1.interval = 1000; timer1.start ();} private void test_tick (...) {// The function body to be executed every second. The function will be executed every second after timer start}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.