Solved

Use of  TStringGrid

Posted on 2000-02-24
3
248 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Process Javascript errors with Delphi TWebBrowser 1 175
HTML text in the body of an email (delphi code) 12 167
Run video youtube webbrowse 10 65
Twebbrowser add css to the header 3 27
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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 shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

856 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