Search code examples
.netwinformseventslifecycle

Difference between closed and formclosed event


Just wondering whats the big difference between Form.Closed and Form.FormClosed event in the order of events of Windows Application. I've read it in MSDN documentation but still couldn't find anything much different from one another. Please explain.


Solution

  • As MSDN says:

    The Closed event is obsolete in the .NET Framework version 2.0; use the FormClosed event instead.

    I don't think you should even consider using this event. It's deprecated and hidden but it's there only for compatibility with old source code.

    It has the same meaning of the FormClosed event but with one (not so much) subtle difference, as you can see on MSDN the Closed event isn't raised when application exists because of a call to Application.Exit() but the FormClosed is.

    This behavior is also documented in the link above:

    The Form.Closed and Form.Closing events are not raised when the Application.Exit method is called to exit your application. If you have validation code in either of these events that must be executed, you should call the Form.Close method for each open form individually before calling the Exit method.