SoFunction
Updated on 2025-03-07

Detailed analysis of the difference between FormClosing and FormClosed in C#

FormClosing Event

The FormClosing event occurs when the form is closed. This event will be processed. Thus, all resources related to the form are released.

If this event is cancelled, the form remains open.

When the form appears as a mode dialog, clicking Close hides the form and sets the DialogResult property to Cancel.

By setting the DialogResult property in some events, the value of DialogResult can be overridden when the user clicks the close button in the upper right corner.

FormClosed Event

The FormClosed event occurs after the form is closed by the user or the Close method or Exit method of the Application class.

This event can be used to release some resources of the form. You can also use this event to save some information in the input form or update the parent form.