473,545 Members | 2,032 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problems with user control and class library. This must be a bug I suppose.

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 like this is a bug or that .NET doesn't
support what I
trying to do.
I hope that one that is is microsoft certified read this because this must
be a bug.

I use VS 2003 and C#.

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.

I have successfully managed to build both the user control dll and the class
library dll.
In the user control dll I have a class called B.

Note that I have only problem in design mode so far.
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 InitializeCompo nent in the form is automatically added
see ** below. As you can see
the constructor for class B in the user control is called and here we
instansiate an object of
class C which exist in the class library dll. This means that when we drag
the
user control from the toolbox we use the class library to instansiate class
C.

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

Here we have the constructor for class B for the user control.
public B()
{
InitializeCompo nent();
C c = new C(); //Here we instansiate a class C in the class library
c.foo();
}
I have a project reference to the class library from the user control.
I also have a project reference to the user control and to the class library
from my project that
build the exe file. In this project I have the form where the user control
is dragged into.

I can build the exe file but my problem is in design mode when the user
control is dragged into a form.

My user control is dependent of class library which mean if I rebuild the
user control
then will the class library also be rebuilt.

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.

As far as I know I have all the references correct set because it works if I
rebuild the user control.
So when I have this error I can solve this error by recompileng the user
control again which rebuild both dll and then it works again when I drag the
user control into a form.

If I do the following my user control will disappear.
1.Rebuild the user control wich rebuild both dll.
2.Drag the user control B into a form.
3.Now rebuild only the class library.
4.Use View designer to look at the user control in the form.
When you do this it will disappear. It will disappear because it can't
find the class library dll for some reason.
Another thing I can't use the workaround that means rebuild the user control
because
that would be a very bad solution. If I can't use it in the way I do now I
must do some change in the design.

One more thing is that if I add some method in the class library and then
rebuild this one
I can see all the added method in "View in object browser" when right
clicking on the last in the references.

I just want to say it's very easy to reproduce my problem and see by
yourself that it's a strange problem.

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

//Tony
Apr 4 '06 #1
0 3919

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

Similar topics

4
2335
by: Morten Aune Lyrstad | last post by:
Ok, now I'm officially confused. I have a large project going, which uses a win32 ui library I am developing myself. And I'm getting weird memory leaks. I don't know if I can explain what is going on, but I really need some help on this one. Ok, so I have this class defined (written by Randy Charles Morin, www.kbcafe.com) which detects...
6
11270
by: martin | last post by:
Hi, I am a web page and a web user control. My web user control is placed in my web page using the following directive <%@ Register TagPrefix="uc1" TagName="Header" Src="WebControls/Header.ascx" %> The web user control contains the following server controls
6
2734
by: Tom Kiefer | last post by:
Question: If I have an ASP.NET User Control which defines/exposes a property that the page can use to specify a mode or data subset for the control to use, is there a way to tell the @OutputCache directive to vary its cache based on that property value? I.e., I have: <my:control runat="server" id="mcOne" Flag="One" /> <my:control...
0
1251
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 library dll called C In the constructor for this user control is a call to a method in the class library. public (){
5
1931
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. Here we have a class called B One project that build a class library dll. Here we have a class called C We have one dependency and that is from the user control to the class library...
1
1522
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 of these left I suppose. I use project reference where a need to.
1
2441
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 of these left I suppose. I use project reference where a need to.
5
1984
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 like this is a bug or that .NET doesn't support what I trying to do. I hope that one that is is microsoft certified read this because this must be a...
5
1909
by: =?Utf-8?B?U2FsYW1FbGlhcw==?= | last post by:
Hi, I have a user control which I like to use in several projects (winforms) in the same solution. Inside lets say Winapp1 , When adding a reference to this control, I can dynamically or statically create it and when running the application it is correctly drawn on the form. But when I take out the reference to this control in Winapp1, ...
0
7473
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7406
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7813
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7431
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5976
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3457
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3444
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1888
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
709
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.