Topic: READING AN EXTERNAL TXT FILE

Hi

I need to read an external txt file to make decissions in VD .
How can it be done ?

Thanks
Elico

Re: READING AN EXTERNAL TXT FILE

Hello,



example:

procedure Form1_Button2_OnClick (Sender: string; var Cancel: boolean);
var
   sl: TStringList;
begin
          sl := TStringList.Create;
          sl.LoadFromFile ('c:\readme.txt');
          ShowMessage(sl.Text);
          sl.Free;
end;
Dmitry.

Re: READING AN EXTERNAL TXT FILE

I need this task to be done in a constant loop .
I need to read a line by line from  the text file .

In each line in the txt file will be written a name of an image.
Each image will be shown in a image component .

How this may be done ?

Thanks
Eliko

Re: READING AN EXTERNAL TXT FILE

procedure Form1_Button2_OnClick (Sender: string; var Cancel: boolean);
var
   sl: TStringList;
   i,c: integer;
begin
          sl := TStringList.Create;
          sl.LoadFromFile ('c:\readme.txt');
          c := sl.Count - 1;

          for i := 0 to c do
          begin
               if i = 0 then Form1.Image1.Picture.LoadFromFile(sl[i]);
               if i = 1 then Form1.Image2.Picture.LoadFromFile(sl[i]);
               if i = 2 then Form1.Image3.Picture.LoadFromFile(sl[i]);
               if i = 3 then Form1.Image4.Picture.LoadFromFile(sl[i]);
          end;

          sl.Free;
end;
Dmitry.

Re: READING AN EXTERNAL TXT FILE

Thanks
Elico