AfterEdit (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This example adds an entry to a memo with a message when an AfterEdit event occurs and when a BeforeEdit event occurs. Click Run SQL to populate the DBGrid. Then select a cell to edit and click the Edit current cell button, or just start editing the cell to invoke the BeforeEdit and AfterEdit events.

Code

procedure TForm1.ClientDataSet1AfterEdit(DataSet: TDataSet);
begin
   Memo2.Lines.Add('After editing record' + IntToStr(DataSet.RecNo));
end;

procedure TForm1.ClientDataSet1BeforeEdit(DataSet: TDataSet);
begin
   Memo2.Lines.Add('Before editing record' + IntToStr(DataSet.RecNo));
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
  ClientDataSet1.Edit;
end;

Uses

See Also

Personal tools
Assistance