在富文本框中输入新行.用vb

问题描述:

大家好,我想知道如何用新行写出短语中的每个单词在richtextbox中,可以说这句话是这个返回一个字符串数组,该数组包含此实例中已定界的子字符串"

Hi guys i want to know how to write every word in a phrase in a new line in a richtextbox lets say the phrase is this "Returns a string array that contains the substrings in this instance that are delimited"

我正在使用的代码是这个

and the code i'm working with is this

Dim words As String = TextBox1.Text
    Dim split As String() = words.Split(New [Char]() {" "c, CChar(vbTab)})

    For Each s As String In split
        If s.Trim() <> "" Then
            RichTextBox1.Text = (s)
        End If
    Next s

但是对于这个,它只会写出句子的最后一个单词.我想要的是将所有单词都写在richtextbox的新行中.

But with this one it only write the last word of the sentence. And what i want is to write all the words each in a new line of the richtextbox.

我喜欢使用 vbCrLf 常量:

RichTextBox1.Text = TextBox1.Text.Replace(" ", vbCrLf).Replace(vbTab, vbCrLf)