Previously, C # was used as the web, and C # was not used as the winform. In the past few days, a household financial management system was created, and the system still had certain availability, however, when processing the close button that comes with the form window, whether I use the close () method or the Resource Recycling method, the ghost cannot be closed, the result is closed using this method. Similar to closing a thread, it should be good. Wow Haha ~
1 /// <Summary>
2 /// Closed button in the Main Window
3 /// </Summary>
4 /// <Param name = "sender"> </param>
5 /// <Param name = "E"> </param>
6 Private Void Mainform_formclosing ( Object Sender, formclosingeventargs E)
7 {
8 Dialogresult result;
9 Result = MessageBox. Show ( " Are you sure you want to exit? " , " Exit " , Messageboxbuttons. okcancel, messageboxicon. Question );
10 If (Result = Dialogresult. OK)
11 {
12 Application. exitthread ();
13 }
14 Else
15 {
16 E. Cancel = True ;
17 }
18 }
The formclosing event of form is added here, but it cannot be done before... Sorry, it is probably because it is too different. Haha record it.