请问如何清空StringGrid里面的数据???急! Delphi / Windows SDK/APIhttp://www.delphi2007.net/DelphiDB/html/delphi_20061224144815132.html
请高手指点,我在StringGrid里面录入数据完后,保存后,想重新录入新的数据,可原先那些数据还在,怎么清空啊?
var
Idx: Integer
with StringGrid do
begin
Perform(WM_SETREDRAW, 0, 0);
try
for Idx := FixedRows to Rowcount - 1 do
Rows[Idx].Clear;
finally
Perform(WM_SETREDRAW, 1, 0);
Invalidate;
end;
end;
stringgird分为2维Tstrings类型,你要清除这样写
For I=0 to StringGrid.ColCount-1 do
StringGrid.cols[I].clear;
建议从列开始,因为行比列多,循环次数多!
谢谢!