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.

Thx.
Catalin80Asked:
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.

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

meikl ;-)
0
Catalin80Author Commented:
Already tryed that. Doesn't work. (delphi6)
0
Catalin80Author Commented:
There is still 1 cell left.
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

huferryCommented:
Do you meant the content only?

procedure ClearStringGrid(Grid: TStringGrid);
var
  I: Integer;
  J: Integer;
begin
  for I := 0 to Grid.ColCount-1 do
    for J := 0 to Grid.RowCount-1 do
      Grid.Cells[I,J] := '';
end;
0
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.
0
kretzschmarCommented:
there allways one cell!
you can't get rid of it
0
Catalin80Author Commented:
Ok. but what was that about "colcont=0;rowcount=0" ?
0
kretzschmarCommented:
>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 ;-)
0
huferryCommented:
if the grid is empty, just make it invisible. Then you'll have no cell at all.

0

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
gangsterbossCommented:
try setting the stringgrids visible property to false when u want to get rid of them all
0
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
Delphi

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.