Loop Loop on Tmemo

Asked

Viewed 37 times

1

I’m using a Tmemo which receives data from an Edit, but this data will be inserted x times, the question is as follows:

By pressing the button the Tmemo received the data as follows:

Memo1.Lines[10] := ('linha adicionada'); 

I would like that when clicking the button the edits were cleaned, and when the person entered the new data and pressing the same button, the data were inserted in the line below in case Memo1.Lines[11]. and so repeatedly..

1 answer

2


Comes to insert into position [10], [11] for example, use:

Memo1.lines.add('linha adicionada');

So you’ll always add on the next line.

And to clean up your Edits use:

edit1.clear;
  • However below the line [10] there is information and your put the Memo1.lines.add ('linha adicionada'); and the person not typing anything, will be blank

  • In case we clarify your doubt, you always want to add a new line above line 10 ?

  • Bottom of line 10. by clicking on the same button as the 10.

  • @Guilhermelima, post your code to clarify your question. Thank you.

  • Memo1.Lines.Add(' dose = ' + funcao);
Memo1.Lines.Add(' '+'if'+' '+ cond1+':');
Memo1.Lines.Add(' '+ enta1); By pressing the button 1 time, Tmemo receives this data .

  • if you use Memo1.Lines.Add it will add in the next line.

  • Totally agree, the problem is how do I do so when I press the X times button, it will be added?

  • Using Memo1.Lines.Add because it will always add at the end of Memo1. Regardless of how many times you click the button.

  • Right, think about this scenario. Variable X gets the data from an Edit, and this variable is written in Tmemo. After that click the Edit button and the X variable will receive new values. And it should be written under the previous one.

  • x := edit1.text; memo1.lines.add(x); .

  • I don’t think I’m explaining myself well I’ll add a real example: Edit will receive the following string: K1 > 90 after giving ok and writing to memo the person will type Edit will receive the following string K1 = 100 this string must be written below K1 > 90

  • So I don’t know where you’re going wrong, because with memo1.lines.add(); will have a result equal to what you expect.

Show 7 more comments

Browser other questions tagged

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