Jak zapisac 2 stringgridy(stringgrid1 i stringgrid2) w 1 pliku (za pomoca savedialog) za 1 kliknieceim w przycisk zapisz a nastepnie zeby to mozna bylo odczytac do tych 2 stringgridów za 1 kliknieciem myszy (i oczywiscie wybraniem pliku)

taki kod mam na zapisanie stringgrida1(ale tylko 1 stringa do 1 pliku)

var
f:textfile;
x,y:integer;
begin

if SaveDialog.Execute then
begin
if FileExists(SaveDialog.FileName) then

savedialog.Execute;
assignfile (f,savedialog.filename);
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;

a taki na odczyt tez tylko 1 stringa

var
f:textfile;
temp,x,y:integer;
tempstr:string;
begin
if openDialog.Execute then
begin

if FileExists(openDialog.FileName) then
assignfile (f,opendialog.filename);
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;

mam nadzieje ze to jest zrozumiałe
z gory dzieki