This document is archived and information here might be outdated.  Recommended version.

IEditor.Location Property (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Editor > ESRI.ArcGIS.Editor > Interfaces > IE > IEditor Interface > IEditor.Location Property
ArcGIS Developer Help

IEditor.Location Property

The last known location of the mouse.

[Visual Basic .NET]
Public ReadOnly Property Location As IPoint
public IPoint Location {get;}

Product Availability

Available with ArcGIS Desktop.


This property is set when you right-click on the edit sketch. Once a point has been stored in this property, it remains there until the next time you right-click on the edit sketch.

Use this property when creating custom commands in the sketch context menu that require a point location to perform some operation. For example, the 'Insert Vertex' command use the location property to determine where to add the new vertex.

If you need the location of the sketch tool for a command in the sketch tool context menu, use the ISketchTool::Location property.
IEditor editor;
//get a reference to m_app(hook) in the ICommand::OnCreate method.
editor = m_app.FindExtensionByName("ESRI Object Editor")

IPoint point = new PointClass();
point = m_editor.Location;
System.Windows.Forms.MessageBox.Show(point.X.ToString("N2") + ", "
  + point.Y.ToString("N2"));
[Visual Basic .NET]
m_app was declared as a module level variable and set to hook in ICommand::OnCreate method. 
This could be used in the ICommand::OnClick method.
Dim m_editor As IEditor
m_editor = m_app.FindExtensionByName("ESRI Object Editor")
Dim point As IPoint
point = m_editor.Location
' To use the messge box you need to add the System.Windows.Forms reference. 
MessageBox.Show(point.X.ToString("N2") + ", " + point.Y.ToString("N2")

See Also

IEditor Interface | esriSketchConstraint Constants | ISketchTool Interface