Udostępnij za pośrednictwem


TextSelection.CharRight(Boolean, Int32) Method

Definition

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

void CharRight(bool Extend = false, int Count = 1);
[System.Runtime.InteropServices.DispId(17)]
public void CharRight (bool Extend = false, int Count = 1);
[<System.Runtime.InteropServices.DispId(17)>]
abstract member CharRight : bool * int -> unit
Public Sub CharRight (Optional Extend As Boolean = false, Optional Count As Integer = 1)

Parameters

Extend
Boolean

Optional. Determines whether the moved text is collapsed or not. The default is false.

Count
Int32

Optional. Represents the number of characters to move to the right. The default is 1.

Attributes

Examples

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  

Remarks

If Extend is true, then the active end of the text selection is moved right Count characters. Otherwise, the text selection 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.

Applies to