470,848 Members | 782 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

roblems when using user control and class library


I use VS 2003 and C#.
I have sent several mail even tried with crossgroup because I want to find
out if my problem
is a bug in .NET or if .NET doesn't support what I do. It's only one of
these left I suppose.

I use project reference where a need to.

I have three project in my solution. One that build the exe and one that
build the user control dll and one that build the class library dll.

Note that I have only problem in design mode.
Look here. This is what I do and what should happen.
I drag the user control icon named B from the Toolbox into a form and when I
do so a row in the InitializeComponent is added see ** below. As you can see
the constructor for class B is used and here we instansiate an object of
class C which exist in the class library. This means that when we drag the
user control from the toolbox we use the class library to instansiate class

private void InitializeComponent()
this.b1= new B();// **

Here we have the constructor for class B for the user control.
public B()
C c = new C(); //Here we instansiate a class in the class library

If I recompile the user control which build both dll everything works fine
when I drag the user control into a form.
If I instead only rebuild the class library and then try to drag the user
control into a form I get this error
"An exception occured while trying to create an instance of
B. The execption was "?"."
This is because the class library can't be found.

So when I have this error I can solve this error by recompileng the user
control again and then it works again.

Has anybody any suggestion about my problem.
Is it a bug or .NET might not fully support what I do.


Apr 3 '06 #1
1 1384
"Tony Johansson" <jo*****************@telia.com> wrote:
[some question]
[This section was removed and saved as file d:\download\programming\p.gif] ??????!!!!!!!!!!

Please don't add any pictures to your posts.
Binaries are not allowed in these groups.
(Not even small ones)
Check / Clean up your stationery / signature.
Martin Kramer
Apr 4 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

14 posts views Thread by pmud | last post: by
1 post views Thread by Tony Johansson | last post: by
5 posts views Thread by Kevin | last post: by
8 posts views Thread by Mihai Velicu | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.