Delen via


EditPoint.CharLeft Method

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

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

Syntax

'Declaration
Sub CharLeft ( _
    Count As Integer _
)
void CharLeft(
    int Count
)
void CharLeft(
    [InAttribute] int Count
)
abstract CharLeft : 
        Count:int -> unit
function CharLeft(
    Count : int
)

Parameters

  • Count
    Type: System.Int32

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

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 the CharRight method.

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

.NET Framework Security

See Also

Reference

EditPoint Interface

EnvDTE Namespace