This documentation is archived and is not being maintained.

TextRanges Collection

Visual Studio .NET 2003

Contains a TextRange Object for each of the tagged subexpressions from a search pattern. Also used for finding where a box selection intersects each line of text.

DTE

   Documents

      Document

         TextDocument

            TextRanges

[Visual Basic .NET]
Public Interface TextRanges
    Inherits IDispatch
[Visual Basic 6]
Class TextRanges
[C++]
interface TextRanges : IDispatch
[C#]
public interface TextRanges : IDispatch
[JScript .NET]
public interface TextRanges extends IDispatch

Remarks

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 find out where the box selection intersects each line.

Example

Sub TextRangesExample()
   Dim objTxtSel As TextSelection
   Dim colRanges As TextRanges
   Dim objRange As TextRange
   Dim objEP As EditPoint

   Set objTxtSel = ActiveDocument.Selection
   Set colRanges = objTxtSel.TextRanges
   For Each objRange In colRanges
      objRange.StartPoint.Insert "/*"
      objRange.EndPoint.Insert "*/"
   Next
End Sub

See Also

Properties, Methods, and Events | TextRange Object | TextSelection Object

Show: