saipo

Catch add element to graphics container event

Discussion created by saipo on Feb 9, 2014
Latest reply on Feb 10, 2014 by Neil
Hi All,

Attempting to do something when a users adds a marker graphic to a map. Using Ver10 SDK and visual studio 200 to create an add-in.

This is code so far


Private m_graphicscontainerelementadded As ESRI.ArcGIS.Carto.IGraphicsContainerEvents_ElementsAddedEventHandler

within a sub

If m_graphicscontainerelementadded Is Nothing Then
Dim graphiccontainevents As ESRI.ArcGIS.Carto.IGraphicsContainerEvents_Event = TryCast(m_map, ESRI.ArcGIS.Carto.IGraphicsContainerEvents_Event)
m_graphicscontainerelementadded = New ESRI.ArcGIS.Carto.IGraphicsContainerEvents_ElementsAddedEventHandler(AddressOf OnGraphicElementsAdded)
AddHandler graphiccontainevents.ElementAdded, m_graphicscontainerelementadded
End If


The following error is generated with the red code highlighted
Error 1 Value of type 'ESRI.ArcGIS.Carto.IGraphicsContainerEvents_ElementsAddedEventHandler' cannot be converted to 'ESRI.ArcGIS.Carto.IGraphicsContainerEvents_ElementAddedEventHandler'.

Can only offer a solution? Used similar method to successfully catch selection changed events with IActiveViewEvents.

Thanks in advance

Outcomes