I need to store the content of Memo1
in a string variable, but that did not work:
sHTML := Memo1.Lines;
I need to store the content of Memo1
in a string variable, but that did not work:
sHTML := Memo1.Lines;
sHTML := Memo1.Text;
This will work, now if you need anything else, please specify in the question.
I usually use Memo1.Lines.Text
It can be done in the following 3 ways, you can create two memos
and one botão
in the event onClick
of the button pass the following code to it:
procedure TForm1.Button1Click(Sender: TObject);
var i: Integer;
AText: String;
begin
Memo2.Lines.Add('Option 1');
for i := 0 to Memo1.Lines.Count -1 do AText := AText + Memo1.Lines[i];
Memo2.Text := Memo2.Text + AText;
Memo2.Lines.Add('--------------------------------------------');
Memo2.Lines.Add('Option 2');
AText := Memo1.Lines.Text;
Memo2.Text := AText;
Memo2.Lines.Add('--------------------------------------------');
Memo2.Lines.Add('Option 3');
AText := Memo1.Text;
Memo2.Text := Memo2.Text + AText;
Memo2.Lines.Add('--------------------------------------------');
end;
The second and third option are practically the same, however the first one will only take the text of each line which may be interesting on certain occasions, now everything will depend on your needs.