Posted by Sharon on May 05, 2007
In Reply to Clearing stringgrid posted by Jim on May 01, 2007
: How do you add data to the stringgrid? From your explanation, I assume that you add a row after the last existing row, that you do something like this:: StringGrid1.RowCount := StringGrid1.RowCount + 1;
: If that's the case, simply add a line to your procedure clear_grid:
: StringGrid1.RowCount := 1;
: If that doesn't solve it, please show us the code by which you add new data.
: Good luck!
: Jim
:
Yes I add data by using row:=row+1;
Thankyou for your help Jim but I still can't get the code to work. When adding your suggested line I am presented with the following error message:
[Error] Unit2.pas(115): Undeclared identifier: 'StringGrid1'.
Perhaps I am not writing the code correctly. Here is what I put:
procedure clear_grid;
var row,col:integer;
begin
for row:=1 to 20 do
for col:=0 to 5 do
form1.StringGrid1.cells[col,row]:='';
StringGrid1.RowCount := 1;
end;
Any glaring mistakes?
Thanks again.
Sharon.
Related articles