CharLeft Method
The document is archived and information here might be outdated

TextSelection.CharLeft Method

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

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

void CharLeft (
	[OptionalAttribute] [InAttribute] bool Extend,
	[OptionalAttribute] [InAttribute] int Count
)
void CharLeft (
	/** @attribute InAttribute() */ /** @attribute OptionalAttribute() */ boolean Extend, 
	/** @attribute InAttribute() */ /** @attribute OptionalAttribute() */ int Count
)
function CharLeft (
	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 left. The default is 1.

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

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

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

Sub ChangeLeftExample()
   ' 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
Show:
© 2016 Microsoft