By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,905 Members | 1,724 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,905 IT Pros & Developers. It's quick & easy.

roblems when using user control and class library

P: n/a
Hello!!

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

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

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

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.

//Tony



Apr 3 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"Tony Johansson" <jo*****************@telia.com> wrote:
Hello!!
[some question]
[This section was removed and saved as file d:\download\programming\p.gif] ??????!!!!!!!!!!
end

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.