This documentation is archived and is not being maintained.

ActivePoint Property

Visual Studio .NET 2003

Returns the current endpoint of the selection.

[Visual Basic .NET]
Public ReadOnly Property ActivePoint() As VirtualPoint
[Visual Basic 6]
Property Get ActivePoint() As VirtualPoint
[C++]
HRESULT __stdcall get_ActivePoint(
   /* [out, retval] */ VirtualPoint** retVal
);
[C#]
public VirtualPoint ActivePoint {get;}
[JScript .NET]
public function get ActivePoint() : VirtualPoint

Return Value

Returns a VirtualPoint object.

Remarks

Although TextPoint Objects indicate the location of the selected text in the Editor window, they don't mark the location in the buffer. Virtual spacethe area beyond the end of the lineis also tracked only in the Editor window. Because of this, when you use an EditPoint Object in the text buffer to modify text, what happens to the selected text is not defined. If you have a command that starts with selected text, gets edit points, then changes the buffer, and you need to guarantee the selected text is in a certain location, you must explicitly place the selected text in that location at the end of your command.

Example

Sub ActivePointExample()
   ' 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.
   objSel.StartOfLine()
   ' 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.
   objSel.EndOfLine()

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

See Also

Applies To: TextSelection Object

Show: