[英]How do i get values into a TextBox in Visual studio C# without the information already on the TextBox gets erased
textBox1.Text = "4 Nuggets"; textBox1.Text = "4 个掘金"; If i wanted to press that again it wont put it as a list instead it will replace it.如果我想再次按下它,它不会把它作为一个列表,而是会替换它。 How do i fix this?我该如何解决?
If you want to write like a list first you should make your textbox multiline.如果你想先像列表一样写,你应该让你的文本框多行。 You may make it from the designer or with code at runtime.您可以通过设计器或在运行时使用代码来实现。 Just wrote make textbox multiline to the inte.net if you did not.如果没有,请将 make textbox multiline 写到 inte.net。
So if you have a textBox like this所以如果你有一个像这样的文本框
=>4 Nuggets => 4个掘金
and you want to add another line like你想添加另一行
=>4 Nugget => 4块
=>2 Chicken =>2鸡
as like in the comments you should use +=, but to pass the next line you should use '\n'就像在注释中一样,您应该使用 +=,但要传递下一行,您应该使用 '\n'
So your code must be something like this.所以你的代码必须是这样的。
string newLine = //something;
textBox1.Text += "'\n'" + newLine;
Or或者
string newLine = //something;
textBox1.Text = textBox1.Text + "'\n'" +
newLine;
If you need further assistance just wrote如果您需要进一步的帮助,请写信
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.