473,545 Members | 2,048 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.UserContr ol
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 3156
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
4939
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 webserver runs that part of the script (see attached file, snippet.php), though, it doesn't go through. I don't get an error message or...
2
2467
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 from the solution? Thanks in advance. Mark
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 of the file is like this:
4
2433
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 MS. Virtually every bit of the site is encapsulated within user controls. The problem begins when you try to have user controls pass information...
14
5748
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 SQL DATABASE, probably by the click of a button. Is this possible? & what is the BEST APPROACH for doing this? & also if any links are there do...
16
1336
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 it was he was doing on the other tab. That may not sound like a big thing but I used the same controls for each tab and then manually cleared the...
0
2553
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 WebMethods as the platform that receives these postings. I don't have any experience with that technology. The sample below is the from test app...
4
11556
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 the image and some display as an icon with the file name below. The process I'm following is as follows; Right click Choose "Insert Object..."...
4
1406
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 different application). When the page_load event of the user control is fired at run-time, none of the form objects on the user control exist. Is this...
0
7484
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
7675
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7440
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
7775
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5344
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3470
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
3451
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1030
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
726
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.