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.