This documentation is archived and is not being maintained.

GetText Method

Visual Studio .NET 2003

Returns the text between the current location and the specified location in the buffer.

[Visual Basic .NET]
Public Function GetText( _
   ByVal PointOrCount As Object _
) As String
[Visual Basic 6]
Function GetText( _
   ByVal PointOrCount As Variant _
) As String
[C++]
HRESULT __stdcall GetText(
   VARIANT PointOrCount,
   /* [out, retval] */ BSTR* retVal
);
[C#]
public string GetText(
   object PointOrCount
);
[JScript .NET]
public function GetText(
   PointOrCount : Object
) : String

Parameters

PointOrCount
Required. Either a TextPoint Object or a number of characters.

Remarks

Returns a string representing the text between the edit point and PointOrCount. If the argument is an integer, then this function returns a string representing the specified number of characters following the edit point (one is added for an implied newline sequence at the end of each line).

If the argument is negative, then GetText returns the text before the edit point.

Example

Sub GetTextExample()
   Dim objTextDoc As TextDocument
   Dim objEditPt As EditPoint, iCtr As Integer
        
   'Create a new text file.
   DTE.ItemOperations.NewFile("General\Text File")
        
   'Get a handle to the new document and create an EditPoint.
   objTextDoc = DTE.ActiveDocument.Object("TextDocument")
   objEditPt = objTextDoc.StartPoint.CreateEditPoint
        
   'Insert ten lines of text.
   For iCtr = 1 To 10
      objeditpt.Insert("This is a test." & Chr(13))
   Next iCtr
   objEditPt.StartOfDocument()
   msgbox("The results of GetText: " & Chr(13) & objeditpt.GetText(4))
End Sub

See Also

Applies To: EditPoint Object

Show: