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

# TDataSet.BeforeClose

Event triggered before the dataset is closed.

## Declaration

Source position: db.pas line 1624

`public property TDataSet.BeforeClose: TDataSetNotifyEvent read FBeforeClose write FBeforeClose;`

## Description

BeforeClose is triggered before the dataset is closed. No actions have been performed yet when this event is called, and the dataset is still in dsBrowse state or one of the editing states. It can be used to prevent closing of the dataset, for instance if there are pending changes not yet committed to the database. If an exception is raised during the event handler, the dataset remains opened.

## See also

TDataset.AfterClose |  | Event triggered after the dataset is closed
TDataset.State |  | Current operational state of the dataset

The latest version of this document can be found at lazarus-ccr.sourceforge.net .