Close winform Program

Source: Internet
Author: User
The winfrom program has three closing methods, which have different features. Assume that Form1, Form2, and Form3.From1 are created by default. In form1, you only need to close the form and use this. close () to close the program. This method will cause the formclosing and fromclosed events of form1. These two events of other forms will not be triggered, and then close the program. Program termination. If you use application. exit () method. When from2 and form3 are enabled, the formclosing event of form1 and the closing event of form2 are triggered once, from3 closing events (the order of form2 and form3 is to see the order of opening, first open first), and then trigger their respective formclosed events in this order. Close. If you use the application. exitthread () method in form1 to close the event, no form close event is triggered. If you use the application. exit () method in from2 to disable the function, the fromclosing event of form is triggered first, and the formclosing event of other forms is triggered in the order of opening the form. The formclosed event is triggered in the same order. If it is the application. exitthread () method, no close event is triggered.

The winfrom program has three closing methods, which have different features. Assume that Form1, Form2, and Form3.From1 are created by default. In form1, you only need to close the form and use this. close () to close the program. This method will cause the formclosing and fromclosed events of form1. These two events of other forms will not be triggered, and then close the program. Program termination. If you use application. exit () method. When from2 and form3 are enabled, the formclosing event of form1 and the closing event of form2 are triggered once, from3 closing events (the order of form2 and form3 is to see the order of opening, first open first), and then trigger their respective formclosed events in this order. Close. If you use the application. exitthread () method in form1 to close the event, no form close event is triggered. If you use the application. exit () method in from2 to disable the function, the fromclosing event of form is triggered first, and the formclosing event of other forms is triggered in the order of opening the form. The formclosed event is triggered in the same order. If it is the application. exitthread () method, no close event is triggered.

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.