Jump to content

How to clear data or refresh data on stringgrid?


CITASys Automation

Recommended Posts

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;

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...