Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Cut
Run
Expand Minimize

CharRight Method

Visual Studio .NET 2003

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

[Visual Basic .NET]
Public Sub CharRight( _
   Optional ByVal Count As Integer = 1 _
) 
[Visual Basic 6]
Sub CharRight( _
   Optional ByVal Count As Int = 1 _
) 
[C++]
HRESULT __stdcall CharRight(
   int Count
);
[C#]
public void CharRight(
   int Count
);
[JScript .NET]
public function CharRight(
   Count : int
)

Parameters

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

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

Example

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

See Also

Applies To: EditPoint Object

Show:
© 2015 Microsoft