如何在Windows窗体的TextBox中添加换行符? [英] How do I add a newline to a windows-forms TextBox?

查看:97
本文介绍了如何在Windows窗体的TextBox中添加换行符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在VB.net中的TextBox组件中添加一行文本,但是我一生都无法弄清楚如何强制使用新行.现在,它只是添加到我已经拥有的东西上,那是不好的.

I am trying to add a line of text to a TextBox component in VB.net, but I cannot figure out for the life of me how to force a new line. Right now it just adds onto what I have already, and that is not good.

我尝试复制实际的换行符,但没有用.我尝试了AppendText(),没有用.

I have tried copying the actual linebreaks, didn't work. I tried AppendText(), didn't work.

到底该怎么做?已经是多行了.

How on earth do I do this? It is multiline already.

推荐答案

尝试使用 Environment.NewLine :

获取为此环境定义的换行字符串.

Gets the newline string defined for this environment.

类似的事情应该起作用:

Something like this ought to work:

textBox.AppendText("your new text" & Environment.NewLine)

这篇关于如何在Windows窗体的TextBox中添加换行符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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