Показать сообщение отдельно
  #47  
Старый 15.04.2008, 18:23
MegaPiha MegaPiha вне форума
Активный
 
Регистрация: 24.03.2008
Сообщения: 227
Версия Delphi: Delphi 7
Репутация: 30
По умолчанию

Цитата:
Сообщение от AndrYxo
MegaPiha - спасибо - ознакомился - только не могу понять как сделать, что бы в файл выводило данные стрингргрида?

Код:
procedure TForm1.Button5Click(Sender: TObject);
var i,j:integer;
outfile: TextFile;
begin
   AssignFile(outfile, 'c:\outfile.txt');
   Rewrite(outfile);
   n:=strtoint(edit1.Text);
   m:=strtoint(edit5.Text);
   n:=12;
   m:=9;
   setlength(C,n,m);
   stringgrid1.RowCount:=n;
   stringgrid1.ColCount:=m;
   for i:=0 to n-1 do
   begin
     for j:=0 to m-1 do
     begin
        C[i,j]:=cos(14*j+1);
        stringgrid1.Cells[j,i]:=FormatFloat('0.00',C[i,j]);
        write(outfile, FormatFloat('0.00',C[i,j])+ ' ');
      end;
     writeln(outfile, '');
    end;
    CloseFile(outfile);
end;