This documentation is archived and is not being maintained.

TextRanges Interface

Contains a TextRange object for each of the tagged subexpressions from a search pattern. TextRanges is also used to find where a box selection intersects each line of text.

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

<GuidAttribute("B6422E9C-9EFD-4F87-BDDC-C7FD8F2FD303")> _
Public Interface TextRanges _
	Inherits IEnumerable
Dim instance As TextRanges

A TextRanges collection is returned from a search operation when the search pattern is a regular expression with tagged subexpressions. The TextRanges collection contains a TextRange object for each of the tagged subexpressions.

Also, TextRanges are used to get box selections from the TextSelection object if you need to determine where the box selection intersects each line.

Sub TextRangeExample(ByVal dte As EnvDTE.DTE)
    Dim objTxtSel As TextSelection
    Dim colRanges As TextRanges
    Dim objRange As TextRange
    Dim objEP As EditPoint

    objTxtSel = dte.ActiveDocument.Selection
    colRanges = objTxtSel.TextRanges
    For Each objRange In colRanges
End Sub