Compartilhar via


DocumentBase.Shutdown Event

Definition

Occurs when the document host item shuts down.

public:
 event EventHandler ^ Shutdown;
public event EventHandler Shutdown;
member this.Shutdown : EventHandler 
Public Custom Event Shutdown As EventHandler 

Event Type

Examples

The following code example adds a new Shutdown event handler that displays a message that shows that the document is shutting down. To use this example, run it from the ThisDocument class in a document-level project.

private void DocumentShutdown()
{
    this.Shutdown +=new EventHandler(ThisDocument_Shutdown2);

}

private void ThisDocument_Shutdown2(object sender, System.EventArgs e)
{
    MessageBox.Show("The Shutdown event was raised.");
}
Private Sub DocumentShutdown()
    AddHandler Me.Shutdown, AddressOf ThisDocument_Shutdown2
End Sub

Private Sub ThisDocument_Shutdown2(ByVal sender As Object, ByVal e As System.EventArgs)
    MessageBox.Show("The Shutdown event was raised.")
End Sub 

Remarks

This is the last event that is raised when the document host item in your project unloads. Use this event for any additional clean up. The application domain for the assembly unloads when the document host item shuts down.

Applies to