繁体   English   中英

如何获取RichTextBox是否具有文本和运行代码

[英]How to get if a RichTextBox has text and run code

我试图获取RichTextBox是否具有任何文本来运行特定代码。

我试过:如果RichTextBox1 =文字然后

但是它没有用。

请帮忙

检查RichTextBox1.Text中是否有任何内容。 因为您的代码没有这样做

If RichTextBox1.Text = "" Then
    MsgBox("there's no text in RichBox")
End If 

此IF块将检查RichTextBox是否为空,还是需要查找任何垂直匹配,请检查

' Obtain the location of the search string in richTextBox1. 
 Dim indexToText As Integer = RichTextBox1.Find(text)

您想知道查找的多个组合检查

    '--------------------------IF Theres Nothing in it-----------------------------

    If RichTextBox1.Text = "" Then
        MsgBox("there's no text in RichBox")
    End If

    '--------------------------IF There in it--------------------------------------


    If RichTextBox1.Text <>"" Then
        MsgBox("there's a text in RichBox")
    End If

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM