Visual Basic (Declaration) | |
---|---|
Public Overloads Function Find( _ ByVal str As System.String _ ) As System.Integer |
C# | |
---|---|
public System.int Find( System.string str ) |
Parameters
- str
The text to locate in the control.
Return Value
The location within the control where the search text was found or a negative one (-1) if the search string is not found or an empty search string is specified in the str parameter.
The Find method searches for the text specified in the str parameter and returns the location of the first character within the control. If the property returns a negative value, the text string being searched for was not found within the contents of the control.
Note The Find methods that accept a string as a parameter cannot find text that is contained on more than one line of text within the RichTextBox. Performing such a search will return a value of negative one (-1).
C# | Copy Code |
---|---|
private void Detail_Format(object sender, System.EventArgs eArgs) { if (this.RichTextBox1.Find("past due")!= -1) { this.txtPayNow.Visible=true; } else { this.txtPayNow.Visible=false; } } |
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("past due") = -1 Then Me.txtPayNow.Visible = True Else Me.txtPayNow.Visible = False End If End Sub |
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2