1

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?

stakx - no longer contributing
  • 83,039
  • 20
  • 168
  • 268

1 Answers1

2

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.

Kim Gräsman
  • 7,438
  • 1
  • 28
  • 41