Solved

TStringGrid.Clear (deletes all cells in a stringgrid)

Posted on 2003-10-26
10
5,757 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

733 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