Click here to Skip to main content
15,886,067 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to use a Richedit to read data from 2 text files at the same time, the reason I want to do this is so that I can then save the content of the richedit in a seperate directory (But I must be clear IT IS IMPERATIVE that I use 2 textfiles in one richedit at the same time, ya know First text is on the first line second text is on the next line), I know you cant do it like this as it would just try to replace the data at the same time thus crashing the program, Please help me solve this conundrum

RDisp is My richedit

Delphi
var
    sStudent:String;
begin
    sStudent:=CbSearch.Text;
    RDisp.Lines.LoadFromFile('Students\' + sStudent + '.zip');
    RDisp.Lines.LoadFromFile('Levels\' + sStudent + '.zip');
end;


What I have tried:

I havent tried much because I am seriously new to delphi, but the internet thus far isnt very helpful as I want a very specific result, thanks for any help provided.
Posted
Updated 21-Sep-16 22:06pm
Comments
[no name] 8-Sep-16 16:15pm    
http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/delphivclwin32/ComCtrls_TRichEdit_Lines.html
Maciej Los 22-Sep-16 12:01pm    
It doesn't look like text file! A '.zip' extension is used with binary files.

1 solution

Use file stream to read your data and then append the data to your rich text box

procedure TForm1.Button1Click(Sender: TObject);
var
  FileStream: TFileStream;
  data: TStringList;
begin
  data := TStringList.Create;
  RichEdit1.Clear;
  data.LoadFromFile('D:\aa.txt');
  RichEdit1.Lines.Append(data.Text);

  data.LoadFromFile('D:\bb.txt');
  RichEdit1.Lines.Append(data.Text);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900