Link to home
Start Free TrialLog in
Avatar of gtas
gtas

asked on

Writing StringGrid to/from a file

In D2, I have a string Grid that I want to save to a file, then later load
it from the file.
I can't seem to get the syntax right.

I've tried WriteToFile, but the Compiler complains, I apparently have to use
WriteToStream.

When I save the StringGrid, I don't appear to get all the information.
Here's my code.

var
fs    : TFileStream;
begin

fs := TFileStream.Create('F:\BBBB', fmCreate or fmShareDenyWrite);

try
       fs.WriteComponent(StringGrid);
except
     ShowMEssage('Error writing Stream');
end;

fs.free;

Any ideas what I'm doing wrong?

Thanks
GMAN

ASKER CERTIFIED SOLUTION
Avatar of ZifNab
ZifNab

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial