Searches the text in the RichTextBox control for a specified string starting at a specified location and with specific options applied to the search.
Syntax
Visual Basic (Usage) | Copy Code |
---|
Dim instance As RichTextBox
Dim str As String
Dim start As Integer
Dim findOptions As RichTextBox.FindOptions
Dim value As Integer
value = instance.Find(str, start, findOptions)
|
Parameters
- str
- The text to locate in the control.
- start
- The location within the control's text at which to begin searching.
- findOptions
- A bitwise combination of the FindOptions values.
Return Value
The location within the control where the search text was found.
Example
C# | Copy Code |
---|
private void Detail_Format(object
sender, System.EventArgs eArgs)
{
if (this.RichTextBox1.Find("expires", 1, RichTextBox.FindOptions.None)!= -1)
{
this.RichTextBox1.SelectionStart = this.RichTextBox1.Find("expires", 1,
RichTextBox.FindOptions.None);
this.RichTextBox1.SelectionLength = 7;
this.RichTextBox1.SelectionColor =
System.Drawing.Color.Crimson;
}
} |
Visual Basic | Copy Code |
---|
Private Sub Detail_Format(ByVal sender As Object, ByVal e As System.EventArgs) Handles Detail.Format
If Not Me.RichTextBox1.Find("expires", 1, RichTextBox.FindOptions.None) = -1 Then
Me.RichTextBox1.SelectionStart = Me.RichTextBox1.Find("expires", 1, RichTextBox.FindOptions.None)
Me.RichTextBox1.SelectionLength = 7
Me.RichTextBox1.SelectionColor = System.Drawing.Color.Crimson
End If
End Sub |
Remarks
See Also