EditPoint.GetText Method
Gets the text between the current location and the specified location in the buffer.
Namespace: EnvDTE
Assembly: EnvDTE (in EnvDTE.dll)
Syntax
'Declaration
Function GetText ( _
PointOrCount As Object _
) As String
string GetText(
Object PointOrCount
)
String^ GetText(
[InAttribute] Object^ PointOrCount
)
abstract GetText :
PointOrCount:Object -> string
function GetText(
PointOrCount : Object
) : String
Parameters
PointOrCount
Type: System.ObjectRequired. Either a TextPoint object or a number of characters.
Return Value
Type: System.String
A string of text located between the current location and the specified location in the buffer.
Remarks
GetText returns a string representing the text between the edit point and PointOrCount. If the argument is an integer, then GetText 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.
Examples
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
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.