Add lines to the top of a memo in Delphi
Asked Answered
G

1

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?

Gamete answered 19/5, 2015 at 19:22 Comment(0)
H
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');
Hoodlum answered 19/5, 2015 at 19:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.