Error Message: Unable to cast object of type

H

hrhoe

Hi,

I'm trying to create a reusable component with C#.
So, I created a user control that uses Microsoft SQLDMO
Object Library (SQLDMO).
And I could add that UserControl on Toolbox.
However, whenever I'm trying to add this user control on
the client program's form I'm getting the following error
message.
----------------------
An exception occurred while trying to create an instance
of RNCLoadCtl.UserControl.
The exception was "Unable to cast object of type
SQLDMO.ApplicationClass to type
SQLDMO.ApplicationClass.".
----------------------
Does anyone know about this error message?
Is there any walkaround of this?
Any comment would be helpful

I'm using the Visual Studio .NET 2002 Soultion
Architecture version on Windows XP professional machine.

Thank you.
 
N

Nicholas Paldino [.NET/C# MVP]

hrhoe,

On the client machine using your user control, try and add the interop
assembly as a reference before you add your control to the form. I think
that it is having a problem here.

Also, it could be that the type wrapper generated by the client machine
is different from yours (if you don't distribute the type wrapper, this
could very well be it). What you would have to do in this case is have the
project reference your wrapper, since it will have a different signature
than the one that their version of VS.NET would create.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top