sanjayjadhav

Casting Error

Discussion created by sanjayjadhav on Dec 23, 2013
Latest reply on Dec 24, 2013 by sanjayjadhav
Hello,

I am trying to cast from IFeatureClass to INetworkClass and I get the following error.

Unable to cast COM object of type 'System.__ComObject' to interface type 'ESRI.ArcGIS.Geodatabase.INetworkClass'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{EE2896B0-5ED8-11D2-AA8A-00C04FA37B82}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

I am using VB.Net in Visual Studio 2010 and ArcObjects SDK 10.2 on X64 Windows 7.

Below is my sample code.


Sub Test ( ByRef pFeatClass as IFeatureClass)

Dim pnF  as INetworkClass 
pnF  = pFeatClass

End Sub


In this simple code, i am getting the above mentioned exception.

I tried, CType,DirectCast also with option Strict Off, but no use.

Any help is much appreciated on this.

Regards,
Kiran.

Outcomes