473,385 Members | 1,712 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

problems when using user control and class library

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
1 2418
Tony I have had this problem intermittently.. were the usercontrol will
disappear for some reason if it can't find the depend dlls, but If I compile
the entire UC project and then my main project all will work fine... I
suggest that you add both projects in the same solution space and then have
reference going , so the UC control builds and then the exe builds... , that
seems to do it.. I know it is sort of pain, but I have not received much
help on this either.... Let me know if you get any other trick to work, I
will be very interested in learning.!

VJ

"Tony Johansson" <jo*****************@telia.com> wrote in message
news:BZ*******************@newsb.telia.net...
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 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: AH | last post by:
I have two functions in my shared library which are declared as follows: void setName(const std::string& str); std::vector<std::string> getInfo(); Since the code is compiled and in shared...
10
by: BBFrost | last post by:
We just recently moved one of our major c# apps from VS Net 2002 to VS Net 2003. At first things were looking ok, now problems are starting to appear. So far ... (1) ...
2
by: Brian | last post by:
NOTE ALSO POSTED IN microsoft.public.dotnet.framework.aspnet.buildingcontrols I have solved most of my Server Control Collection property issues. I wrote an HTML page that describes all of the...
0
by: Tony Johansson | last post by:
Hello! I have one solution file that consist of three project. One project that build the exe file. called A One project that build a user control dll called B One project that build a class...
0
by: tony | last post by:
Hello! I have one solution file that consist of three project. One project that build the exe file called A One project that build a user control dll. In this user control we have a class...
1
by: Tony Johansson | last post by:
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...
0
by: tony | last post by:
Hello! This is a rather long mail but it's a very interesting one. I hope you read it. I have tried several times to get an answer to this mail but I have not get any answer saying something...
0
by: Dirk | last post by:
Hello, I have a class library with many classes and properties. For every property I have a PropertyNameChanged event. In my user interface layer it sometimes happens that I subscribe such an...
0
by: drawing in aspnet | last post by:
Question about putting the data layer in a separate class library. I keep reading that the data layer should be separated from the presentation layer and put in its own class library. I am...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.