[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Empty a StringGrid

Posted on 2000-01-03
6
Medium Priority
?
586 Views
Last Modified: 2008-02-01
Hello,

How do I empty or clear a StringGrid?

(Like the Edit Box where you have the property Clear).

I have until now solved it with a Loop where I empty all visible cells (cell by cell for every row), but that doesn't work very well since I don't know, at the "empty point", how large the grid is going to be in the future (the, for the moment, unvisible cells doesn't get emptied).

Kind Regards/ Henrik
0
Comment
Question by:swghewc
  • 3
  • 2
6 Comments
 
LVL 17

Accepted Solution

by:
inthe earned 400 total points
ID: 2320605
hi,
you can do like:

procedure TForm1.Button1Click(Sender: TObject);
var
i : integer;
begin
for i := 0 to stringgrid1.Rows[0].Count -1
do begin
stringgrid1.rows[i].clear;
end;
end;

Regards Barry
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2320617
Here are 2 ways to clear the entire grid:

  with StringGrid1 do
    for i := 0 to RowCount - 1 do
      Rows[i].Clear;

  with StringGrid1 do
    for i := 0 to ColCount - 1 do
      Cols[i].Clear;
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2320620
Sorry Barry, didn't see your answer......
0
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.

 
LVL 17

Expert Comment

by:inthe
ID: 2320629
hi epsylon,
long time no read
hope you had good xmas and new year :-)
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2321263
Well I have but I wish it was 1900 so I would have more time to do the thing I need to do    :o)
0
 

Expert Comment

by:Gurkan
ID: 2322067
I have a faster solution if u'd like unlock this question
0

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

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…
This is an update to some code that someone else posted on Experts Exchange. It is an alternate approach, I think a little easier to use, & makes sure that things like the Task Bar will update.
SQL Database Recovery Software repairs the MDF & NDF Files, corrupted due to hardware related issues or software related errors. Provides preview of recovered database objects and allows saving in either MSSQL, CSV, HTML or XLS format. Ensures recov…
Free Data Recovery software is an advanced solution from Kernel Tools to recover data and files such as documents, emails, database, media and pictures, etc. It supports recovery from physical & logical drive after a hard disk crash, accidental/inte…

612 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