Click here to Skip to main content
15,912,329 members
Home / Discussions / C#
   

C#

 
GeneralClosing a form :) Pin
Cristoff30-Jul-04 20:57
Cristoff30-Jul-04 20:57 
GeneralRe: Closing a form :) Pin
leppie30-Jul-04 22:22
leppie30-Jul-04 22:22 
GeneralRe: Closing a form :) Pin
Cristoff30-Jul-04 22:30
Cristoff30-Jul-04 22:30 
GeneralRe: Closing a form :) Pin
Roman Rodov1-Aug-04 14:21
Roman Rodov1-Aug-04 14:21 
GeneralRe: Closing a form :) Pin
Cristoff30-Jul-04 22:23
Cristoff30-Jul-04 22:23 
GeneralRe: Closing a form :) Pin
Heath Stewart30-Jul-04 23:23
protectorHeath Stewart30-Jul-04 23:23 
GeneralRe: Closing a form :) Pin
Cristoff31-Jul-04 0:45
Cristoff31-Jul-04 0:45 
GeneralRe: Closing a form :) Pin
Heath Stewart31-Jul-04 4:48
protectorHeath Stewart31-Jul-04 4:48 
Because the form is already closing. If the form is your main form - the one you passed to Application.Run, once it's closed the application will exit anyway. There may already be messages in the pump that were posted that may need to clean-up resources. Calling Application.Exit circumvents that. So, if you don't set CancelEventArgs.Cancel to true, the form will close and the application will exit just as if you hadn't handled the Form.Closing event.

And what do you mean you can't find it? It's documented in the .NET Framework SDK, and if you use the designer you can click the "Events" button in the PropertyGrid when your form is selected, find the Closing event and double-click it. You can also use IntelliSense.

The thing is, you're not looking for Form.Closing, you're looking for this.Closing or form1.Closing or whatever is appropriate for accessing your instance of your form. Some basic understanding of programming is assumed. Closing is an instance event, so it will be defined for an instance of your form (so access it using this or a variable that refers to your Form).

 

Microsoft MVP, Visual C#
My Articles
GeneralRe: Closing a form :) Pin
Cristoff31-Jul-04 19:44
Cristoff31-Jul-04 19:44 
GeneralRe: Closing a form :) Pin
Heath Stewart1-Aug-04 5:44
protectorHeath Stewart1-Aug-04 5:44 
GeneralRe: Closing a form :) Pin
mikker_1231-Aug-04 14:35
mikker_1231-Aug-04 14:35 
GeneralVisual Styles Pin
eggie530-Jul-04 19:26
eggie530-Jul-04 19:26 
GeneralRe: Visual Styles Pin
Heath Stewart30-Jul-04 23:20
protectorHeath Stewart30-Jul-04 23:20 
GeneralWant to make a good C# window Application Pin
softp_vc30-Jul-04 17:33
softp_vc30-Jul-04 17:33 
GeneralRe: Want to make a good C# window Application Pin
Heath Stewart30-Jul-04 19:10
protectorHeath Stewart30-Jul-04 19:10 
GeneralRe: Want to make a good C# window Application Pin
softp_vc1-Aug-04 17:48
softp_vc1-Aug-04 17:48 
GeneralRe: Want to make a good C# window Application Pin
Heath Stewart4-Aug-04 5:00
protectorHeath Stewart4-Aug-04 5:00 
GeneralMenuItem adding and removing at run time Pin
StephenMcAllister30-Jul-04 15:10
StephenMcAllister30-Jul-04 15:10 
GeneralRe: MenuItem adding and removing at run time Pin
Heath Stewart30-Jul-04 19:19
protectorHeath Stewart30-Jul-04 19:19 
GeneralDisabling Mouse wheel scrolling - Scenario Pin
Tristan Rhodes30-Jul-04 14:16
Tristan Rhodes30-Jul-04 14:16 
GeneralRe: Disabling Mouse wheel scrolling - Scenario Pin
Heath Stewart30-Jul-04 19:08
protectorHeath Stewart30-Jul-04 19:08 
GeneralMessage pump exception catching Pin
Hugo Hallman30-Jul-04 13:21
Hugo Hallman30-Jul-04 13:21 
GeneralRe: Message pump exception catching Pin
Heath Stewart30-Jul-04 19:06
protectorHeath Stewart30-Jul-04 19:06 
GeneralApplication displaying Japanese, German, and English text. Pin
jerrycainjr30-Jul-04 12:28
jerrycainjr30-Jul-04 12:28 
GeneralRe: Application displaying Japanese, German, and English text. Pin
Heath Stewart30-Jul-04 12:59
protectorHeath Stewart30-Jul-04 12:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.