[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Classes' (#rtl)

# TDataModule.Destroy

Destroys the TDataModule instance.

## Declaration

Source position: classesh.inc line 2156

`public destructor TDataModule.Destroy; override;`

## Description

Destroy destroys the TDataModule instance. If the OldCreateOrder property is True the OnDestroy event handler is called prior to destroying the data module.

Before calling the inherited destroy, the RemoveDataModule handler is called if it is set, and Self is passed as a parameter.

## Errors

An event can be raised during the OnDestroy event handler.

## See also

TDataModule.OnDestroy |  | Event handler, called when the datamodule is destroyed.
RemoveDataModule |  | Handler called when a TDataModule instance is freed.