Показать сообщение отдельно
  #1  
Старый 15.12.2008, 13:16
mazaev87 mazaev87 вне форума
Прохожий
 
Регистрация: 02.12.2008
Сообщения: 4
Репутация: 10
По умолчанию ПОМОГИТЕ С ОШИБКОЙ

ПРОБЛЕМА ВЫВОДЕ ИЗ ФАЙЛА ТЕКСТА В МЕМО ОКНО!ПОМОГИТЕ,ПЖЛ, ЗАРАНЕЕ БЛАГОДАРЕН!

Код:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    Label1: TLabel;
    Memo1: TMemo;
    OpenDialog1: TOpenDialog;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
OpenDialog1.Execute;
end;

procedure TForm1.Button2Click(Sender: TObject);
var
AFile:textFile;
Field,data,vals:Tstringlist;
i,J:integer;
line,line1,rec,a:string;
Potok:TStringStream;
begin
  Field:=TStringList.Create;
  data:=TStringlist.Create;
  Potok:=TStringStream.Create(rec);
  try
    begin
    Assignfile(Afile,openDialog1.FileName);
    Reset(Afile);
    While not eof(Afile) do
    begin
    Readln(AFile,rec);
    potok.WriteString(rec);
    try
    finally
end;
end;
System.CloseFile(Afile);
line:=Potok.DataString;
line1:=Stringreplace(line,')))','^',[rfReplaceall]);
line:=stringReplace(line1,' ','_',[rfReplaceall]);
  field.Clear;
  data.Clear;
  vals.Clear;
      Field.Delimiter:='^';  
      Vals.Delimiter:='|'; 
      Data.Delimiter:='=';
      Field.DelimitedText:=line;
      for i:=0 to Field.Count -1 do begin
      Vals.DelimitedText:=Field[i];
      for j:=0 to Vals.Count -1 do begin
      memo1.Lines.Append(Vals[j]);
       data.DelimitedText:=Vals[j];
            if j=0 then begin
               data[0];
               a:=data[0];
               delete(a,1,3);
             //  label2.Caption:=a;
               memo1.lines.Append(j+1).AsString:=a
               end
               else
               memo1.Lines.Append(data[0]).AsString:=data[1];

            end;
            end;
                finally
     end;
end;
end.

lmikle: Пользуемся тегами, иначе будет наказание. И не кричи, плз (большиби буквами не надо писать).
Вложения
Тип файла: rar программа.rar (5.4 Кбайт, 2 просмотров)
Ответить с цитированием