Share via


DocumentBase.Shutdown Event

Occurs when the document host item shuts down.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

Syntax

'Declaration
Public Event Shutdown As EventHandler
public event EventHandler Shutdown

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.

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 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 
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.");
}

.NET Framework Security

See Also

Reference

DocumentBase Class

Microsoft.Office.Tools.Word Namespace