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
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

TextSelection.StartOfLine Method

Moves the object to the beginning of the current line.

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

void StartOfLine (
	[OptionalAttribute] [InAttribute] vsStartOfLineOptions Where,
	[OptionalAttribute] [InAttribute] bool Extend
void StartOfLine (
	/** @attribute InAttribute() */ /** @attribute OptionalAttribute() */ vsStartOfLineOptions Where, 
	/** @attribute InAttribute() */ /** @attribute OptionalAttribute() */ boolean Extend
function StartOfLine (
	Where : vsStartOfLineOptions, 
	Extend : boolean



Optional. A vsStartOfLineOptions constant representing where the line starts.


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

If Extend is True, then only the active end of the selected text is moved to the start of the document. Otherwise, the selected text is collapsed and moved.

Sub StartOfLineExample()
   ' Before running this example, open a text document.
   Dim objSel As TextSelection = DTE.ActiveDocument.Selection
   Dim objActive As VirtualPoint = objSel.ActivePoint
   ' Collapse the selection to the beginning of the line.
   ' objActive is "live", tied to the position of the actual selection, 
   ' so it will reflect the new position.
   Dim iCol As Long = objActive.DisplayColumn
   ' Move the selection to the end of the line.

   MsgBox("The length of the insertion point line is " & (objActive.DisplayColumn - iCol) & " display characters.")
End Sub

Community Additions

© 2015 Microsoft