在不替换行的情况下将新行添加到文本框

问题描述:

我正在创建一个基本程序,在其中在文本框中输入内容,然后单击Enter,数据将显示在多行文本框中.在关闭表单之前,每次输入新数据并按Enter键时,数据将显示在多行文本框的底部,而不会覆盖或擦除已有的内容.

I am creating a basic program where I enter something in a text box and when I click enter, the data shows up in a multi-line textbox. Until I close the form, each time I enter new data and hit enter, the data will appear at the bottom of the multi-line textbox without overwriting or erasing what is already there. How would I code this in VB.net?

我只是将文本设置为textbox1.Text=strText;
或者只是清除文本框.
I would just set the text to textbox1.Text=strText;
Or simply clear the text box.


代码是什么?您的问题根本不是很清楚.

就像其他人说的那样,如果要替换TextBox中的文本,只需将新值分配给它的Text属性.

如果要将新文本追加到TextBox中已有的文本,请使用其Append()方法.
Code what? Your question is not very clear at all.

Like the other person said, if you want to replace the text in the TextBox, just assign the new value to its Text property.

If you want to append new text to what''s already in the TextBox, use its Append() method.


textbox1.MultiLine=true;
textbox1.ScrollBars=Vertical;