Auto-generating a closing event handler in Visual Studio 2010
In the forms designer of Visual Studio 2010, you can auto-generate event handlers (mostly done by double-clicking on the control that you want an event handler created for). However, I cannot determine how to auto-generate a closing event handler (not a closed event handler). Can any of you VS2010 gurus show m开发者_运维问答e the way? Not sure if this matters, but this is for a Visual C# program.
To clarify, I'm looking for a way to auto-generate the closing event handler (this event happens when a user clicks the close/cancel button, but fires before the app actually closes).
Thanks!
Click on the window of your application and in the properties section (bottom right), click on the events tab, and then go to the Close and then type in a name of the method and it should create one for you in the code-behind.
精彩评论