Add lines in a certain place of Tmemo

Asked

Viewed 1,693 times

1

I have some variables that receive some data from a common DIT. My doubt is the following, the person will click the button and Tmemo will receive the data, I would like in this action it cleaned the same Dit and repeat the process as often as necessary, but I need to insert this data in the middle of the Tmemo, as the example below:

    Memo1.Lines.Add(var1); #linha adicionada ao clicar no botão.
    Memo1.Lines.Add('linha adicionada'); # essa linha deve ser adicionada após a
    anterior quando o usuário clicar no mesmo botão.
    Memo1.Lines.Add('linha adicionada2');

1 answer

1


You can use the following command to write on a certain line of the TMemo:

Memo1.Lines[3] := 'asd';

Or you can do so too:

Memo1.Lines.Insert(3, 'asd');

If you need to delete a specific line use:

Memo1.Lines.Delete(3);
  • Interesting your answer, helped a lot. Maybe you can help me I’m new to this. I’m writing on lines 9 and 10. I would like when he pressed the button again he would write on the 11 and 12 and so on. It is possible?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.