Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clear StringGrid 1

Status
Not open for further replies.

lespaul

Programmer
Feb 4, 2002
7,083
US
Other than looping through each cell in a string grid using variables, is there an easy way to clear all the data in the grid? Thanks!


Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual

Essential reading for anyone working with databases: The Fundamentals of Relational Database Design
 

You can loop through the columns and clear one column at a time. And it will be a bit faster if you set Visible to False first (then re-set it to True).

(If you have more columns than rows, loop through the rows and clear one row at a time.)

 
Is there a ClearRow/ClearColumn function?

thanks,
les
 

All you need is something like this:
Code:
procedure TForm1.Button1Click(Sender: TObject);
var
  nCol:integer;
begin
  for nCol := 0 to StringGrid1.ColCount - 1 do
    StringGrid1.Cols[nCol].Clear;
end;

 
I see it now! I was looking everywhere for Clear, but couldn't find it! thanks!

leslie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top