tags:

views:

158

answers:

1

I'm using an interoped COM assembly in my 1.1 VB.NET code, and when I try to set a property of the class, I get an INvalidCastException error with the message "QueryInterface for Interface xxx failed". Any ideas on this?

A: 

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 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.

Kim Gräsman