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

# TDataSource.OnDataChange

Called whenever data changes in the current record

## Declaration

Source position: db.pas line 1936

`published property TDataSource.OnDataChange : TDataChangeEvent read FOnDataChange write FOnDataChange;`

## Description

OnDatachange is called whenever a field value changes: if the Field parameter is set, a single field value changed. If the Field parameter is Nil, then the whole record changed: when the dataset is opened, when the user scrolls to a new record. This event handler can be set to react to data changes: to update the contents of non-DB-aware controls for instance. The event is not called when the datasource is not enabled.

## See also

TDatasource.OnUpdateData |  | Called whenever the data in the dataset must be updated
TDatasource.OnStateChange |  | Called whenever the state of the dataset changes
TDataset.AfterScroll |  | Event triggered after the cursor has changed position.
TField.OnChange |  | Event triggered when the field's value has changed
TDatasource.Enabled |  | Enable or disable sending of events