当前位置: 首页>>代码示例>>VB.NET>>正文


VB.NET RichTextBox.Find方法代码示例

本文整理汇总了VB.NET中System.Windows.Forms.RichTextBox.Find方法的典型用法代码示例。如果您正苦于以下问题:VB.NET RichTextBox.Find方法的具体用法?VB.NET RichTextBox.Find怎么用?VB.NET RichTextBox.Find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.RichTextBox的用法示例。


在下文中一共展示了RichTextBox.Find方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。

示例1: FindMyText

Public Function FindMyText(ByVal searchText As String, ByVal searchStart As Integer, ByVal searchEnd As Integer) As Integer
    ' Initialize the return value to false by default.
    Dim returnValue As Integer = -1

    ' Ensure that a search string and a valid starting point are specified.
    If searchText.Length > 0 And searchStart >= 0 Then
        ' Ensure that a valid ending value is provided.
        If searchEnd > searchStart Or searchEnd = -1 Then
            ' Obtain the location of the search string in richTextBox1.
        Dim indexToText As Integer = richTextBox1.Find(searchText, searchStart, searchEnd, RichTextBoxFinds.MatchCase)
            ' Determine whether the text was found in richTextBox1.
            If indexToText >= 0 Then
                ' Return the index to the specified search text.
                returnValue = indexToText
            End If
        End If
    End If

    Return returnValue
End Function
开发者ID:VB.NET开发者,项目名称:System.Windows.Forms,代码行数:20,代码来源:RichTextBox.Find

示例2: FindMyText

Public Function FindMyText(text As String, start As Integer) As Integer
    ' Initialize the return value to false by default.
    Dim returnValue As Integer = - 1
    
    ' Ensure that a search string has been specified and a valid start point.
    If text.Length > 0 And start >= 0 Then
        ' Obtain the location of the search string in richTextBox1.
        Dim indexToText As Integer = richTextBox1.Find(text, start, _
            RichTextBoxFinds.MatchCase)
        ' Determine whether the text was found in richTextBox1.
        If indexToText >= 0 Then
            returnValue = indexToText
        End If
    End If
    
    Return returnValue
End Function
开发者ID:VB.NET开发者,项目名称:System.Windows.Forms,代码行数:17,代码来源:RichTextBox.Find

示例3: Char

Private Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.Click
    MessageBox.Show(FindMyText(New Char() {"B"c, "r"c, "a"c, "v"c, "o"c}).ToString())
End Sub


Public Function FindMyText(ByVal [text]() As Char) As Integer
    ' Initialize the return value to false by default.
    Dim returnValue As Integer = -1

    ' Ensure that a search string has been specified and a valid start point.
    If [text].Length > 0 Then
        ' Obtain the location of the first character found in the control
        ' that matches any of the characters in the char array.
        Dim indexToText As Integer = richTextBox1.Find([text])
        ' Determine whether the text was found in richTextBox1.
        If indexToText >= 0 Then
            ' Return the location of the character.
            returnValue = indexToText
        End If
    End If

    Return returnValue
End Function
开发者ID:VB.NET开发者,项目名称:System.Windows.Forms,代码行数:23,代码来源:RichTextBox.Find

示例4: Char

Private Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.Click
    MessageBox.Show(FindMyText(New Char() {"B"c, "r"c, "a"c, "v"c, "o"c}, 5).ToString())
End Sub


Public Function FindMyText(ByVal text() As Char, ByVal start As Integer) As Integer
    ' Initialize the return value to false by default.
    Dim returnValue As Integer = -1

    ' Ensure that a valid char array has been specified and a valid start point.
    If [text].Length > 0 And start >= 0 Then
        ' Obtain the location of the first character found in the control
        ' that matches any of the characters in the char array.
        Dim indexToText As Integer = richTextBox1.Find([text], start)
        ' Determine whether any of the chars are found in richTextBox1.
        If indexToText >= 0 Then
            ' Return the location of the character.
            returnValue = indexToText
        End If
    End If

    Return returnValue
End Function
开发者ID:VB.NET开发者,项目名称:System.Windows.Forms,代码行数:23,代码来源:RichTextBox.Find

示例5: FindMyText

Public Function FindMyText(text As String) As Boolean
    ' Initialize the return value to false by default.
    Dim returnValue As Boolean = False
    
    ' Ensure a search string has been specified.
    If text.Length > 0 Then
        ' Obtain the location of the search string in richTextBox1.
        Dim indexToText As Integer = richTextBox1.Find(text)
        ' Determine whether the text was found in richTextBox1.
        If indexToText >= 0 Then
            returnValue = True
        End If
    End If
    
    Return returnValue
End Function
开发者ID:VB.NET开发者,项目名称:System.Windows.Forms,代码行数:16,代码来源:RichTextBox.Find

示例6: FindMyText

Public Function FindMyText(text As String) As Boolean
    ' Initialize the return value to false by default.
    Dim returnValue As Boolean = False
    
    ' Ensure a search string has been specified.
    If text.Length > 0 Then
        ' Obtain the location of the search string in richTextBox1.
        Dim indexToText As Integer = richTextBox1.Find(text, RichTextBoxFinds.MatchCase)
        ' Determine if the text was found in richTextBox1.
        If indexToText >= 0 Then
            returnValue = True
        End If
    End If
    
    Return returnValue
End Function
开发者ID:VB.NET开发者,项目名称:System.Windows.Forms,代码行数:16,代码来源:RichTextBox.Find


注:本文中的System.Windows.Forms.RichTextBox.Find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。