CITASys Automation Posted September 16, 2022 Share Posted September 16, 2022 Hi how to clear data from a stringgrid or make a refresh on a stringgrid? thankyou Quote Link to comment Share on other sites More sharing options...
Sherzod Posted September 16, 2022 Share Posted September 16, 2022 Hello, 6 hours ago, CITASys Automation said: how to clear data from a stringgrid One possible solution: procedure TMainForm.UniButton3Click(Sender: TObject); var I, J: Integer; begin with UniStringGrid1 do begin BeginUpdate; for I := 0 to ColCount-1 do for J := 0 to RowCount-1 do Cells[I,J] := ''; EndUpdate; end; end; Quote Link to comment Share on other sites More sharing options...
Abaksoft Posted September 17, 2022 Share Posted September 17, 2022 On 9/16/2022 at 4:12 AM, CITASys Automation said: Hi how to clear data from a stringgrid or make a refresh on a stringgrid? thankyou Hello, Try this : procedure TMainForm.Clear_My_UniStringGridClick(Sender: TObject); begin BeginUpdate; //1. Force all to Zero UniStringGrid1.RowCount:=0; UniStringGrid1.ColCount:=0; //2. Re introduce Col and Row Count UniStringGrid1.RowCount:=100; UniStringGrid1.ColCount:=5; EndUpdate; // UniStringGrid1.Refresh; // UniStringGrid1.Repaint; end; This works only for clearing the UniStirngGrid, but keep in memory the OLD values ! so, if you do showmessage( UniStringGrid1.Cells[2,3] ); after clearing, you will get the old value. Quote Link to comment Share on other sites More sharing options...
CITASys Automation Posted September 20, 2022 Author Share Posted September 20, 2022 ok sherzod thankyou for help! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.