This document is archived and information here might be outdated. Recommended version. |
ArcObjects namespaces > Editor > ESRI.ArcGIS.Editor > Classes > E > EditEvents2 Class (ArcObjects .NET 10.4 SDK) |
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.
Interfaces | Description |
---|
Interfaces | Description |
---|---|
IEditEvents2 (default) | Provides access to more editor events. Implement it to listen for specific events that occur during an edit session. |
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.");
}
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
When working with EditEvents2's default outbound interface in Visual Basic 6 declare variables as follows:
Private WithEvents pEditEvents2 as EditEvents2