如何在 Visual Studio C# 中将值放入 TextBox 中,而不删除 TextBox 上已有的信息
textBox1.Text = "4 块金块"; 如果我想再次按下它,它不会将其作为列表,而是会替换它。我该如何解决这个问题?
textBox1.Text = "4 Nuggets";
If i wanted to press that again it wont put it as a list instead it will replace it. How do i fix this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想首先像列表一样编写,则应该将文本框设置为多行。
您可以通过设计器或在运行时使用代码来制作它。如果你没有的话,就在互联网上写了 make textbox multiline 。
因此,如果您有一个像这样
=>4 Nuggets 的
文本框,并且您想添加另一行,例如
=>4 Nugget
=>2 Chicken,
就像注释中一样,您应该使用 +=,但要传递下一行,您应该使用 '\n'
所以你的代码必须是这样的。
或者
如果您需要进一步的帮助,请写下
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 internet if you did not.
So if you have a textBox like this
=>4 Nuggets
and you want to add another line like
=>4 Nugget
=>2 Chicken
as like in the comments you should use +=, but to pass the next line you should use '\n'
So your code must be something like this.
Or
If you need further assistance just wrote