Solved

Use of  TStringGrid

Posted on 2000-02-24
3
247 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
ID: 2555465
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
ID: 2555536
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
ID: 2558515
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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
URL for downloading Google Chrome for Win XP 2 155
Delphi inherited method 6 70
how can i search if string exist in array ? 3 58
how to change, disabled button color FMX ? 1 33
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

777 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