ArcObjects Library Reference (Editor)  

EditEvents2 Class

Helper coclass for working with the nondefault outbound IEditEvents2 interface in VB.

EditEvents2 is a non-creatable object. References to non-creatable objects must be obtained through other objects.

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Interfaces

Interfaces Description

Event Interfaces

Interfaces Description
IEditEvents2 (default) Provides access to more editor events. Implement it to listen for specific events that occur during an edit session.
[C#]

The following code shows how to wire edit events in C#.

public void WireEditEvents2()
{
  UID editorUid = new UIDClass(); 
  editorUid.Value = "esriEditor.Editor";

  //You can get app from ICommand :: OnCreate() hook parameter  
  IEditor editor = app.FindExtensionByCLSID(editorUid) as IEditor;
  ((IEditEvents2_Event)editor).OnVertexAdded += 
    new IEditEvents2_OnVertexAddedEventHandler(OnVertexAdded);
}
void OnVertexAdded(IPoint point)
{
  System.Windows.Forms.MessageBox.Show("Vertex Added.");
}
[Visual Basic .NET]

The following code shows how to wire edit events in VBNet.

  Public Sub WireEditEvents()
    'You can get app from ICommand :: OnCreate() hook parameter
    Dim editorUid As UID = New UIDClass()
    editorUid.Value = "esriEditor.Editor"
    Dim editor As IEditor = TryCast(app.FindExtensionByCLSID(editorUid), IEditor)

    'Wire editor events.
    AddHandler (CType(editor, IEditEvents2_Event).OnVertexAdded), AddressOf OnVertexAdded
  End Sub

  Private Sub OnVertexAdded(ByVal point As IPoint)
    System.Windows.Forms.MessageBox.Show("Vertex Added.")
  End Sub

Working with Events

[Visual Basic 6.0]

When working with EditEvents2's default outbound interface in Visual Basic 6 declare variables as follows:

Private WithEvents pEditEvents2 as EditEvents2