CharRight Method

EditPoint.CharRight Method (Int32)


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

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

void CharRight(
	int Count = 1


Type: System.Int32

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

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 CharRight performs identically to CharLeft method.

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.
End Sub
Return to top
© 2016 Microsoft