TextPane2.IncrementalSearch Property

Provides access to the incremental search (ISearch) capability of the text editor.

Namespace:  EnvDTE80
Assembly:  EnvDTE80 (in EnvDTE80.dll)

Syntax

'Declaration
ReadOnly Property IncrementalSearch As IncrementalSearch
IncrementalSearch IncrementalSearch { get; }
property IncrementalSearch^ IncrementalSearch {
    IncrementalSearch^ get ();
}
abstract IncrementalSearch : IncrementalSearch with get
function get IncrementalSearch () : IncrementalSearch

Property Value

Type: EnvDTE80.IncrementalSearch
An IncrementalSearch object.

Examples

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. For more information about how to run this example as an add-in, see How to: Compile and Run the Automation Object Model Code Examples.

Imports EnvDTE
Imports EnvDTE80
Public Sub OnConnection(ByVal application As Object, _
 ByVal connectMode As ext_ConnectMode, ByVal addInInst As Object, _
 ByRef custom As Array) Implements IDTExtensibility2.OnConnection
    _applicationObject = CType(application, DTE2)
    _addInInstance = CType(addInInst, AddIn)
    TextPane2IncrementalSearchExample(_applicationObject)
End Sub
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

.NET Framework Security

See Also

Reference

TextPane2 Interface

EnvDTE80 Namespace