Compartilhar via


EditPoint2.CharLeft(Int32) Method

Definition

Moves the edit point the specified number of characters to the left.

void CharLeft(int Count = 1);
[System.Runtime.InteropServices.DispId(101)]
public void CharLeft (int Count = 1);
[<System.Runtime.InteropServices.DispId(101)>]
abstract member CharLeft : int -> unit
Public Sub CharLeft (Optional Count As Integer = 1)

Parameters

Count
Int32

Optional. The number of characters to move to the left. The default is 1 character.

Implements

Attributes

Examples

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

CharLeft moves the edit point left the indicated number of characters. If the beginning of the document is reached before the indicated number of characters, the cursor remains at the beginning of the document. If the edit point is at the beginning of a line, then CharLeft leaves it at the end of the previous line. That is, all newline sequences are treated as a single character.

If the value of Count is negative, then CharLeft performs identically to CharRight method.

Applies to