RAD Studio VCL Reference
TCustomADODataSet.OnFetchProgress Event

Occurs periodically during an asynchronous data retrieval operation.

property OnFetchProgress: TFetchProgressEvent;
__property TFetchProgressEvent OnFetchProgress;

Write an OnFetchProgress event handler to take specific action during an asynchronous data retrieval operation. The OnFetchProgress event fires periodically during the data retrieval to provide indications of its progress. Create a handler for this event to react to this periodic notification, such as providing the user with a visual indication of the progress of the data retrieval. 

DataSet is the ADO dataset component that triggered the OnFetchProgress event. This dataset component also contains the recordset in question. 

Progress is the number of records that have been received since the data fetching operation began. 

MaxProgress is the total number of records to be retrieved by the operation. 

Progress and MaxProgress used together to get percent complete. For example, Progress divided by MaxProgress and multiplied by 100 yields the percent completion of the data fetching.

procedure TForm1.ADODataSet1FetchProgress(DataSet: TCustomADODataSet; Progress, MaxProgress: Integer; var EventStatus: TEventStatus);
  Caption := 'Percent complete: ' +
    IntToStr(Trunc(Progress / MaxProgress * 100)) + '%';


void __fastcall TForm1::ADODataSet1FetchProgress(TCustomADODataSet *DataSet, int Progress, int MaxProgress, TEventStatus &EventStatus)
  Caption = "Percent complete: " +
    IntToStr(Trunc(Progress / MaxProgress * 100)) + "%";


Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!