Author: Tomas Rutkauskas
I have a form with a stringgrid on it. I use the grid to display some data
regarding a certain part. How do I clear the grid, that still holds data from the
first display, before I display data of a different part?
Answer:
You have to loop over the rows or cols or even cells (depends on how the grid is
layed out):
1 with StringGrid1 do2 begin3 perform(WM_SETREDRAW, 0, 0); {block visual updates}4 try5 for i := fixedRows to Rowcount - 1 do6 Rows[i].Clear;
7 finally8 perform(WM_SETREDRAW, 1, 0);
9 invalidate;
10 end;
11 end;
Since this wipes complete rows it would not be suitable if you have a fixed column on the left that should be preserved, for example.