将空间转换为换行符 - vb.net

时间:2016-01-03 18:52:56

标签: vb.net

我有一些像TextBox这样的数据:

word1 word2 word3 word4 word5

这些字从其他文件中提取,由于某些原因我无法使用vbCrLf - vbCr - vbLf - vbNewLine - 等

是否可以将单词之间的空格转换为vbCrLf? 我的期望:

word1
word2
word3
word4
word5

2 个答案:

答案 0 :(得分:0)

好吧,我不确定我理解你在说什么,但是如果你从其他文件中输入单词而你想要换行你想要这样做:

    textBox1.Text = (code to import) & Enviroment.NewLine & etc...

所以你可以试试。

编辑:对不起,你可以试试这个:

Dim txt As String = (code to import) & Enviroment.NewLine & etc..

然后你可以这样做:

textBox1.Text = txt

答案 1 :(得分:0)

感谢posted it to the command line tools' issue tracker

正如我所料,我可以用换行符替换空格

target = target.Replace(" ", Environment.NewLine)
TextBox1 = target