本文整理汇总了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
示例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
示例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
示例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
示例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
示例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