Solved

TStringGrid.Clear (deletes all cells in a stringgrid)

Posted on 2003-10-26
10
5,544 Views
Last Modified: 2007-12-19
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.
0
Comment
Question by:Catalin80
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 9623277
just set the rowcount- and colcount-properties to 0 (zero)

meikl ;-)
0
 

Author Comment

by:Catalin80
ID: 9625942
Already tryed that. Doesn't work. (delphi6)
0
 

Author Comment

by:Catalin80
ID: 9625954
There is still 1 cell left.
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 3

Expert Comment

by:huferry
ID: 9625962
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
 

Author Comment

by:Catalin80
ID: 9626412
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
 
LVL 27

Expert Comment

by:kretzschmar
ID: 9626550
there allways one cell!
you can't get rid of it
0
 

Author Comment

by:Catalin80
ID: 9626901
Ok. but what was that about "colcont=0;rowcount=0" ?
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 9626919
>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
 
LVL 3

Accepted Solution

by:
huferry earned 50 total points
ID: 9632430
if the grid is empty, just make it invisible. Then you'll have no cell at all.

0
 
LVL 2

Expert Comment

by:gangsterboss
ID: 9647093
try setting the stringgrids visible property to false when u want to get rid of them all
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question