469,964 Members | 1,645 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,964 developers. It's quick & easy.

Error Message: Unable to cast object of type

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.


Nov 15 '05 #1
1 4057
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.

--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"hrhoe" <hr***@hotmail.com> wrote in message
news:0e****************************@phx.gbl...
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.

Nov 15 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Pankaj Jain | last post: by
reply views Thread by Wes Shaddix | last post: by
reply views Thread by ritesh.singhal | last post: by
6 posts views Thread by Bmack500 | last post: by
1 post views Thread by rainxy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.