T
Tony Johansson
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
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