EditPoint.Delete(Object) Method

Definition

Deletes the specified range of text.

[System.Runtime.InteropServices.DispId(135)]
public void Delete (object PointOrCount);
Parameters
PointOrCount
Object

Required. Represents either a TextPoint object or a number of characters.

Examples

Sub DeleteExample()  
   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  

   ' Change the first letter of the fourth word of the fourth line.  
   objEditPt.StartOfDocument()  
   objEditPt.LineDown(3)  
   objEditPt.WordRight(3)  
   objEditPt.CharRight(2)  
   objEditPt.Charleft(2)  
   objeditpt.Delete(1)  
   objEditPt.Insert("p")  
End Sub  

Remarks

If PointOrCount is a TextPoint object, Delete deletes the text between the edit point and PointOrCount. If PointOrCount is an integer, then Delete deletes the text from the edit point through the specified number of characters following the edit point, adding one for each implied newline sequence at the end of each line.

If PointOrCount is negative, then Delete deletes text before the edit point.

Applies to