다음을 통해 공유


EditPoint.GetText(Object) Method

Definition

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

public:
 System::String ^ GetText(System::Object ^ PointOrCount);
public:
 Platform::String ^ GetText(Platform::Object ^ PointOrCount);
std::wstring GetText(winrt::Windows::Foundation::IInspectable const & PointOrCount);
[System.Runtime.InteropServices.DispId(134)]
public string GetText (object PointOrCount);
[<System.Runtime.InteropServices.DispId(134)>]
abstract member GetText : obj -> string
Public Function GetText (PointOrCount As Object) As String

Parameters

PointOrCount
Object

Required. Either a TextPoint object or a number of characters.

Returns

A string of text located between the current location and the specified location in the buffer.

Attributes

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  

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.

Applies to