A brief talk on C # application. Doevent effect

Source: Internet
Author: User
Tags message queue

Application.doevents (): Handles all of the Windows messages currently in the message queue.

[C-sharp]View PlainCopy
    1. Private void button1_click (object sender, EventArgs e)
    2. {
    3. For (int i = 0; i < 10000; i++)
    4. {
    5. Label1. Text = i.ToString ();
    6. Application.doevents ();
    7. }
    8. }

Test, there is no application.doevents (), the label is basically in a false state, the last display of a 9999, plus the number will be converted to normal display.

From this test after the DoEvents function, should be doevents like to achieve the synchronization of the process. At no time, because of the priority problem, the program will execute the main process code, and then execute the code, and add the later can be executed synchronously.

A brief talk on C # application. Doevent effect

Related Article

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.