如何检查StringGrid中的单元格是否被修改

use*_*630 1 delphi delphi-7 tstringgrid

我想知道如何以编程方式确定字符串网格的单元格中的数据是否被修改?

我在表单中有一个字符串网格.stringgrid的数据是从数据库加载的.如果用户修改数据,我想更改数据库中的数据.

请分享代码.

谢谢

Jer*_*dge 5

TStringGrid类具有OnSetEditText在用户更改单元格中的数据时触发的事件.使用AColARow在事件处理程序的参数中识别哪个单元格已被修改...

procedure TForm1.StringGrid1SetEditText(Sender: TObject; ACol, ARow: Integer;
  const Value: string);
begin
  //Use ACol/ARow to know what has changed, and Value to know what the new data is.

end;
Run Code Online (Sandbox Code Playgroud)