Board index » delphi » Scrolling text file contents

Scrolling text file contents

Hi Guys,

I've a text file and want to scroll the contents in a window.  I've a
component to do this but don't know how to load a txt file with say
30(variable) lines in it into one string seperated by "   -   ".

(Ages since programmed anything so would be greatful if someone could give a
little snippit of code or some pointers please)

Regards
Mark

 

Re:Scrolling text file contents


Hi Mark ...

I've done something like this using a TListBox on a form as it will
create scrollbar for you.

For Example  ::

// --snip --//

var
  myfile: TextFile;
  fileName,inString : String;
begin

    fileName := 'C:\urDir\urTextFile.Txt';

    AssignFile(myFile, fileName);
    Reset(myFile);
    while not Eof (myFile) do
    begin
       // read the text file one line at a time
       ReadLn(myFile, +'-'+inString+'-');

       // now load the TList box one line at a time
       listbox1.items.add(inString)
    end;

    CloseFile(myFile);

end;

Quote
>I've a text file and want to scroll the contents in a window.  I've a
>component to do this but don't know how to load a txt file with say
>30(variable) lines in it into one string seperated by "   -   ".

Hope this Helps;

--
Phil Tusa

Other Threads