AnsweredAssumed Answered

Set EventTable

Question asked by shaningesri on Sep 24, 2013
Latest reply on Sep 26, 2013 by shaningesri
From http://forums.arcgis.com/threads/14202-Inserting-LR-Event-Features-with-VBA, where the code is in VBA:
  Dim pRouteEventSource As IRouteEventSource
  Set pRouteEventSource = pFLayer.FeatureClass
I tried to setup an EventTable like that:
            ESRI.ArcGIS.Location.IRouteEventSource pRouteEventSource = fc;  // fc - a defined FeatureClass
But I got compile error warning under fc: Can't explicitly convert IFeatureClass to IRouteEventSource.
The, I cast it like that
            ESRI.ArcGIS.Location.IRouteEventSource pRouteEventSource = (ESRI.ArcGIS.Location.IRouteEventSource)fc;
            ITable pTable = pRouteEventSource.EventTable;
The compile error was gone.  But then I got runtime error:  Unable to cast COM object of type 'System.__ComObject' to interface type 'ESRI.ArcGIS.Location.IRouteEventSource'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{641755F0-B7DE-11D3-9F7C-00C04F6BDF06}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
I hope someone can help me for the possible solution.  Thanks.

Outcomes