Capture Close Button
-
I am using Visual Studio 2005 to write a C# program. And I am wondering if anyone tell me if there is a programattic way to differentiate when a form is being closed via the Close() method as opposed to being closed via a user clicking on the control box 'x'? The CloseReason seems to be the same for either one, and I would like to know which 'Close' is occurring if possible. Thank You...
-
I am using Visual Studio 2005 to write a C# program. And I am wondering if anyone tell me if there is a programattic way to differentiate when a form is being closed via the Close() method as opposed to being closed via a user clicking on the control box 'x'? The CloseReason seems to be the same for either one, and I would like to know which 'Close' is occurring if possible. Thank You...
-
I am using Visual Studio 2005 to write a C# program. And I am wondering if anyone tell me if there is a programattic way to differentiate when a form is being closed via the Close() method as opposed to being closed via a user clicking on the control box 'x'? The CloseReason seems to be the same for either one, and I would like to know which 'Close' is occurring if possible. Thank You...
Look up the
OnClosing
event handler, you can handle the close from there."Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
-
I am using Visual Studio 2005 to write a C# program. And I am wondering if anyone tell me if there is a programattic way to differentiate when a form is being closed via the Close() method as opposed to being closed via a user clicking on the control box 'x'? The CloseReason seems to be the same for either one, and I would like to know which 'Close' is occurring if possible. Thank You...
Thanks everyone for the replies. Unfortunately my initial message was not as detailed as it should have been. I know about the FormClosing event and how I could trap a flag I set before programtically executing a Form.Close(). However, what I really need to know is the difference between the closes that can be executed on the title bar. Either the 'x' close in the right corner, or the 'Close' that can be executed from the dropdown appears when you click in the left corner (on the icon). Can those be differentiated in the Closing event?
-
Thanks everyone for the replies. Unfortunately my initial message was not as detailed as it should have been. I know about the FormClosing event and how I could trap a flag I set before programtically executing a Form.Close(). However, what I really need to know is the difference between the closes that can be executed on the title bar. Either the 'x' close in the right corner, or the 'Close' that can be executed from the dropdown appears when you click in the left corner (on the icon). Can those be differentiated in the Closing event?