473,507 Members | 2,374 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Trouble with using User Control in different projects

VS.2003, .NET Framework 1.1, C#
My goal: Creating a dll (helper.dll) which contains some UserControls
and some other helpful classes in order to use it in other projects.
Symtoms: The inital use of the UserControl component works. However, if

the Helper Project is recompiled, the UserControl does not work
correctly anymore in the other projects. Furthermore, the previously
visible User Control may not be visible in the Windows Form Designer.
Here the steps I have done:
1) Created a new Project (Helper Project)
2) Added some classes and a UserControl (there are some textboxes,
dropdown boxes, etc.)
Remark: UserControl (ctlHelper.cs)
public class ctlHelper : System.Windows.Forms.UserControl
3) Compiled the procject.
Now the next steps are including the dll in the desire project.
1) Created a new Project
2) Added a new reference to the helper.dll
3) Add -> Add Inherited Control -> Inherited User Control -> Browse to
the helper.dll location -> OK
Now the designed UserControl appears in the Toolbox of VS.2003 under
"My User Controls"
4) Drag & Drop the UserControl to the windows form. Write some code,
compile.
This work so far.
But if I made any change in the helper project, compiling it (the
public interface of the helper.dll is untouched!) all Projects which
using the UserControl getting trouble. In all the projects the
UserControl is disappeared from "My User Controls", further, the
Windows Form Designer does not show the UserControl on the Windows Form

as where it was before. The ctlHelper.cs file is still part of the
project. The written code using the UserControl is there, too.
Compiling works too. But if I run the application the UserControl is
not shown in the Windows Form.
The problem is similar as described in KB 818220, but I am useing .NET
UserControl.
http://support.microsoft.com/?kbid=818220
Also the workaround works but it is unacceptable. This helper
repository should be used by several programmers in their projects. The

user control should gives consistency across all projects.
What to do in order to get this working?
Any help is appreciated. Thanks in advance.
cw

Jan 25 '06 #1
7 3152
Could this just be a versioning issue?

If you have strong-named your control's assembly, then referencing dlls will
be expecting the exact version.

If you are currently using dynamic version numbers (e.g. 1.0.*.* which uses
the date/time), try pinning it to 1.0.0.0; alternatively, you could use a
versioning policy in either the GAC or the config file (depending on how it
is deployed)

Not 100% (or even 30%) sure, but well worth a try, if only so you know what
the issue is...

Marc
Jan 25 '06 #2
> If you are currently using dynamic version numbers
(e.g. 1.0.*.* which uses the date/time), try pinning it
to 1.0.0.0;


Quit simply but really really helpful. Thanks for the hint, it seems to
work perfect for the purpose of the helper class.

Thank you a lot!

cw

Jan 25 '06 #3
Glad it helped

Marc
Jan 25 '06 #4
Unfortunately the bad behavior is back. Not sure for what reason, but
suddenly the UserControl was disappeared. I have recreated a the
UserControl, used it and after some time, bang :( The version of the
dll is still 1.0.0.0.

Does any alternative to UserControls exist?

Thanks in advance.

Jan 25 '06 #5
My stab-in-the-dark knowledge is exhausted here I'm afraid.

Marc
Jan 25 '06 #6
In my experience, if you recompile a library that contains controls
(such as UserControls) then you have to also recompile the project that
uses it before you can use the Designer. Try this after you recompile
your Helper.dll:

1. Switch to the project you want to work on.
2. Close all open Designer windows
3. Rebuild the project.
4. Reopen the Designer windows.

This has always worked for me, and I don't even bother with the version
numbering trick. Is it a bit annoying? Yes. However, UserControls are
so useful that it would be a shame to do some twisted thing in order to
avoid them just so that you don't have to recompile your projects.

Jan 25 '06 #7
Hello Bruce,

Thanks for your suggestion. I will give it a try. You are right, the
numbering trick is a bit annoying, but acceptable if it works. As I
already mentioned, several programmers used this helper library and its
UserControl. Probably most of them do not notice whether the helper dll
is recompiled. Even if you forget to close the Designer window /
rebuild project, you have to recreate the UserControl.

However, it looks like a big trouble spot to use the same UserControl
in different projects.

About UserControl Class from the MSDN:
"You might consider creating a namespace that contains several classes
of user controls and compiling it into one DLL. This DLL can be
referenced and distributed with the application or all applications
within an organization. This gives you the ability to reference the
user control in many applications and save time laying out and coding
the contained elements of the user control. A user control also gives
you consistency within or across applications; for example, all address
information input blocks will all have the same appearance and
behavior. Consistency gives your application a more polished and
professional appearance."

Yeah, this is exactly what I need. Therefore I am sure that I missed a
important point, because it can't so buggy to use it.

Any further suggestions/hints are very welcome.

Jan 26 '06 #8

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

Similar topics

9
4935
by: Penn Markham | last post by:
Hello all, I am writing a script where I need to use the system() function to call htpasswd. I can do this just fine on the command line...works great (see attached file, test.php). When my...
2
2466
by: Mark | last post by:
Is there a realistic way for some developers on our team to work with multiple projects in a single solution under VSS source control, and have other developers only working with a single project...
0
1394
by: Tariq Ahmad | last post by:
hi, i have a web user control which i share to different projects via Visual Source Safe. problem i have is that each project wants to change the inherits bit in the ascx file: so one copy...
4
2431
by: Josh Harris | last post by:
Here is my question: It is common to have many pieces of business logic encapsulated within asp.net user controls. This can be found in high visibility projects such as the iBuySpy portal from...
14
5733
by: pmud | last post by:
Hi, I need to use an Excel Sheet in ASP.NET application so that the users can enter (copy, paste ) large number of rows in this Excel Sheet. Also, Whatever the USER ENETRS needs to go to the...
16
1331
by: scorpion53061 | last post by:
Well as some of you know I was using a tab control for a project I was building for my boss. Today he tells me that he wants: When he switches tabs to be able to switch back and see whatever...
0
2547
by: joshblair | last post by:
Hello, I am trying to post XML documents to a third party using the HttpWebRequest. This URL uses HTTPS (SSL) but I don't have a client certificate to deal with. Apparently they are using...
4
11554
by: Rico | last post by:
Hello, I have an MDE application where I use a bound object frame to display an image. This frame is updatable and bested on the contents of an OLE field. My problem is, some images display as...
4
1402
by: Jenni.Haughton | last post by:
I have a solution with 2 projects in it. I need to programatically add a user control from one project into the other one (as you cannot declare this normally on the form because it is in a...
0
7111
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
7319
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7376
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...
1
7031
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...
0
7485
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3191
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...
0
1542
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 ...
1
760
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.