TextPane2::IncrementalSearch Property
Visual Studio 2015
Provides access to the incremental search (ISearch) capability of the text editor.
Assembly: EnvDTE80 (in EnvDTE80.dll)
This example opens a text document, creates an IncrementalSearch object, and then searches for the character "t" in the text displayed on the text pane
Imports EnvDTE Imports EnvDTE80 Sub TextPane2IncrementalSearchExample(ByVal dte As DTE2) Dim objTW As TextWindow Dim objPane As TextPane2 Dim objTextDoc As TextDocument Dim objTextPt As TextPoint Dim objEP As EditPoint Dim incSearch As IncrementalSearch ' Create a new text document. _applicationObject.ItemOperations.NewFile("General\Text File") ' Get a handle to the new document and create EditPoint, ' TextPoint, and TextPane objects. objTextDoc = CType(_applicationObject.ActiveDocument.Object _ ("TextDocument"), TextDocument) objEP = objTextDoc.StartPoint.CreateEditPoint objTextPt = objTextDoc.StartPoint ' Plug in some text. objEP.Insert("A test sentence.") objTW = CType(dte.ActiveWindow.Object, TextWindow) objPane = CType(objTW.ActivePane, TextPane2) ' Create an incremental search object. incSearch = objPane.IncrementalSearch incSearch.StartForward() MsgBox("Searching for a 't'.") incSearch.AppendCharAndSearch(Asc("t")) incSearch.Exit() End Sub
Show: