I'm using an interop COM assembly in my 1.1 VB.NET code, and when I try to set a property of a class, I get an InvalidCastException
with the message "QueryInterface for Interface … failed."
Any ideas on this?
I'm using an interop COM assembly in my 1.1 VB.NET code, and when I try to set a property of a class, I get an InvalidCastException
with the message "QueryInterface for Interface … failed."
Any ideas on this?
First, make sure your COM component is registered with regsvr32.exe.
Then, make sure any necessary marshalling support is also registered -- these come in one of two kinds:
1) proxy/stub DLL, usually called <YourComponent>ps.dll -- register this too with regsvr32.exe
2) Associated type library -- register this with regtlib.exe
If you used tlbimp on your DLL, try using regtlib to register the DLLs type library.