Solved

Use of  TStringGrid

Posted on 2000-02-24
3
242 Views
Last Modified: 2012-05-04
An easy one...

How do I use the TStringGrid component?

Thanks in advance...
   Boomer Dragon
0
Comment
Question by:boomerdragon
3 Comments
 
LVL 7

Expert Comment

by:daniel_c
Comment Utility
What do you mean by that question?
What do you want to do with TStringGrid?
0
 
LVL 17

Accepted Solution

by:
inthe earned 50 total points
Comment Utility
hi,
drop stringtid onto form and in object insector set the goediting option to true;
run the project and type some stuff in grid..
thats it.
do whatecvver wit the text..
can save and load the grid to file like this:
procedure TForm1.Button1Click(Sender: TObject);
var
 f:textfile;
 x,y:integer;
begin
assignfile (f,'C:\STRING.TXT');
rewrite (f);
writeln (f,stringgrid1.colcount);
writeln (f,stringgrid1.rowcount);
For X:=0 to stringgrid1.colcount-1 do
For y:=0 to stringgrid1.rowcount-1 do
writeln (F, stringgrid1.cells[x,y]);
closefile (f);
END;
procedure TForm1.Button2Click(Sender: TObject);
var f:textfile;
temp,x,y:integer;
tempstr:string;
begin
assignfile (f,'c:\string.txt');
reset (f);
readln (f,temp);
stringgrid1.colcount:=temp;
readln (f,temp);
stringgrid1.rowcount:=temp;
For X:=0 to stringgrid1.colcount-1 do
 For y:=0 to stringgrid1.rowcount-1 do begin
         readln (F, tempstr);
 stringgrid1.cells[x,y]:=tempstr;
 end;
closefile (f);

end;


hope that help
Regards Barry
0
 

Author Comment

by:boomerdragon
Comment Utility
Thank you very much. I'm trying to move from the VB world, and this StringGrid was a puzzle :-). I was looking for something like a "Format String". Now I know that makes no difference.

Thanks again!

Boomer Dragon
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This video discusses moving either the default database or any database to a new volume.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

762 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now