Partager via


EditPoint2.CharRight(Int32) Method

Definition

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

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

Parameters

Count
Int32

Optional. The number of characters to move to the right. The default is one character.

Implements

Attributes

Examples

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

CharRight moves the edit point to the right the indicated number of characters. If the end of the document is reached before Count characters, the point remains at the end of the document. If the edit point is at the end of a line, then CharRight leaves it at the beginning of the next line. That is, all newline sequences are treated as a single character.

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

Applies to