This documentation is archived and is not being maintained.

CharRight Method (TextSelection Object)

Visual Studio .NET 2003

Moves the object the specified number of characters to the right.

[Visual Basic .NET]
Public Sub CharRight( _
   Optional ByVal Extend As Boolean = False, _
   Optional ByVal Count As Integer = 1 _
) 
[Visual Basic 6]
Sub CharRight( _
   Optional ByVal Extend As Boolean = False, _
   Optional ByVal Count As Long = 1 _
) 
[C++]
HRESULT __stdcall CharRight(
   VARIANT_BOOL Extend,
   long Count
);
[C#]
public void CharRight(
   bool Extend,
   int Count
);
[JScript .NET]
public function CharRight(
   Extend : Boolean,
   Count : int
)

Parameters

Extend
Optional. Determines whether the moved text is collapsed or not. The default is False.
Count
Optional. Represents the number of characters to move to the right. The default is 1.

Remarks

If Extend is True, then the active end of the selected text is moved right Count characters. Otherwise, the selected text is collapsed and positioned Count characters to the right of the active end.

If the end of the document is encountered before Count characters, then the position is left at the end of the document. If the active end is at the end of a line, then CharLeft leaves it at the beginning of the next line. That is, all newline sequences are treated as a single character.

If Count is negative, then CharRight acts like the CharLeft Method.

Example

Sub CharRightExample()
   ' Open a document before running this example.
   Dim objSel As TextSelection = DTE.ActiveDocument.Selection
   objSel.StartOfDocument(True)
   objSel.StartOfLine(vsStartOfLineOptions.vsStartOfLineOptionsFirstText)
   objSel.CharRight(True, 4)
   objSel.ChangeCase(vsCaseOptions.vsCaseOptionsUppercase)
   MsgBox("Turned text uppercase.")
   objSel.CharLeft(False, 1)
   objSel.ChangeCase(vsCaseOptions.vsCaseOptionsLowercase)
   MsgBox("Turned text lowercase.")
End Sub

See Also

Applies To: TextSelection Object

Show: