在不替换行的情况下将新行添加到文本框 [英] adding new lines to a textbox without replacing lines

查看:81
本文介绍了在不替换行的情况下将新行添加到文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个基本程序,在其中在文本框中输入内容,然后单击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;


这篇关于在不替换行的情况下将新行添加到文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆