Solved

TStringGrid.Clear (deletes all cells in a stringgrid)

Posted on 2003-10-26
10
5,658 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

 
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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

829 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