Mega Code Archive

 
Categories / Delphi / VCL
 

How to copy the content of TRichEdit

Title: How to copy the content of TRichEdit Question: How to copy the content from one RichEdit control to another ? Answer: TMemoryStream is an easy interface between all VCL components: procedure TForm1.Button1Click(Sender: TObject); var MemoryStream:TMemoryStream; begin MemoryStream:=TMemoryStream.Create; try RichEdit1.Lines.SaveToStream(MemoryStream); MemoryStream.Seek(0,soFromBeginning); RichEdit2.Lines.LoadFromStream(MemoryStream); finally MemoryStream.Free; end; end;