TStringGrid.Clear (deletes all cells in a stringgrid)

I need a method ("Clear") that clears all cells of a string grid and then deletes them.

So stringgrid.Clear finally DELETES ALL CELLS (ROWS/COLS..whatever you like) of the stringgrid.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

just set the rowcount- and colcount-properties to 0 (zero)

meikl ;-)
Catalin80Author Commented:
Already tryed that. Doesn't work. (delphi6)
Catalin80Author Commented:
There is still 1 cell left.
Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

Do you meant the content only?

procedure ClearStringGrid(Grid: TStringGrid);
  I: Integer;
  J: Integer;
  for I := 0 to Grid.ColCount-1 do
    for J := 0 to Grid.RowCount-1 do
      Grid.Cells[I,J] := '';
Catalin80Author Commented:
The content AND the CELLS. I need one tstringgrid WITH NO CELLS. If that isn't possible then I just can hide the entire table.
there allways one cell!
you can't get rid of it
Catalin80Author Commented:
Ok. but what was that about "colcont=0;rowcount=0" ?
>but what was that about "colcont=0;rowcount=0" ?
that deletes the whole content from the grid,
that one cell left is a default painting bahaviour, if the grid is empty
-> maybe this could be adjusted by using ownerdraw

meikl ;-)
if the grid is empty, just make it invisible. Then you'll have no cell at all.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
try setting the stringgrids visible property to false when u want to get rid of them all
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.