TextSelection::FindText Method (String^, Int32)
Visual Studio 2015
Searches for the given text from the active point to the end of the document.
Assembly: EnvDTE (in EnvDTE.dll)
Parameters
- Pattern
-
Type:
System::String^
Required. The text to find.
- vsFindOptionsValue
-
Type:
System::Int32
Optional. A vsFindOptions constant indicating the search options to use.
Return Value
Type: System::BooleanA Boolean value indicating true if the text is found, false if not.
FindText searches for the given text string from the text selection's active end to the end of the text document. The return value indicates whether the text is found. If the text is found, the edit point is moved to the beginning of the match. Otherwise, the edit location is unchanged.
If the matched pattern is a regular expression and contains tagged subexpressions, then the Tags argument returns a collection of TextRange objects, one for each tagged subexpression.
Sub FindTextExample() ' Before running this example, open a text document. Dim objSel As TextSelection = DTE.ActiveDocument.Selection ' Looks for the first occurence of the word, test, in the current ' document. If found, the line is selected. If objSel.FindText("test", vsFindOptions.vsFindOptionsFromStart) Then objSel.SelectLine() End If End Sub
Show: