7

The function Memo.Lines.Add('Some text') in Delphi adds the string to the bottom of the memo. Is there any function which adds the text to the top?

For example, if the Lines property of the Memo contains:

string 1
string 2
string 3

I want to add a string string 0 before string 1. How can I do that?

Michael
  • 41,989
  • 11
  • 82
  • 128
Tim Lâm
  • 124
  • 1
  • 2
  • 13

1 Answers1

13

The Lines property is a TStrings instance that supports inserting at a specified line number. The method to do so is Insert and is called like this:

Memo.Lines.Insert(0, 'string 0');
David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490