472,790 Members | 1,633 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

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 InitializeComponent 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 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 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 3863

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

Similar topics

4
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...
6
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"...
6
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...
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...
5
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...
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...
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...
5
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...
5
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...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.