From http://forums.arcgis.com/threads/142...tures-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.
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.