在富文本框中输入新行.用vb [英] Write in new line in rich text box. with vb

查看:58
本文介绍了在富文本框中输入新行.用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)

这篇关于在富文本框中输入新行.用vb的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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