Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to clear a TStringGrid Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
05-Nov-02
Category
VCL-General
Language
Delphi 2.x
Views
82
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Tomas Rutkauskas

I have a form with a stringgrid on it. I use the grid to display some data 
regarding a certain part. How do I clear the grid, that still holds data from the 
first display, before I display data of a different part?

Answer:

You have to loop over the rows or cols or even cells (depends on how the grid is 
layed out):

1   with StringGrid1 do
2   begin
3     perform(WM_SETREDRAW, 0, 0); {block visual updates}
4     try
5       for i := fixedRows to Rowcount - 1 do
6         Rows[i].Clear;
7     finally
8       perform(WM_SETREDRAW, 1, 0);
9       invalidate;
10    end;
11  end;


Since this wipes complete rows it would not be suitable if you have a fixed column on the left that should be preserved, for example.

			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC