473,608 Members | 2,457 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Complex question about using collections from derived Controls in V. Studio Designer

Hi,

I'm writng a control derived from UserControl (let's call this control
MyControl) that itself is meant to be derived further times.

MyControl hosts a public collection of specialized non-GUI objects.
This collection is therefore accesible from any controls derived from
MyControl. Derived controls have to be able to add, change and remove
objects from the collection.

In MyControl I set the DesignerVisibil ity to Content so that the
code-generation engine properly generates the code for the collection
and when I initialize MyControl, I add some objects to the collection.

Now, here's where the problem starts. The code generation for controls
derived from MyControl will generate code to create and add all
objects in the collection, even if some of these were added in
MyControl and there's already code (in MyControl) to create and add
them.

The situation is similar to that of the ControlCollecti on in Controls,
but here somehow, the code-generator doesn't add controls present in
the super-calss again.

I could not find any references or documentation of how to deal with
this, so I'm asking for some help. Has anybody had some experience
with this?

Sebastian

PS: I'll post some code if anybody needs an alternative explanation.
Thanks
Jul 21 '05 #1
0 1376

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

Similar topics

0
311
by: Sebastian Ferreyra | last post by:
Hi, I'm writng a control derived from UserControl (let's call this control MyControl) that itself is meant to be derived further times. MyControl hosts a public collection of specialized non-GUI objects. This collection is therefore accesible from any controls derived from MyControl. Derived controls have to be able to add, change and remove objects from the collection.
3
5301
by: scoobydoo | last post by:
Hello, I am trying to implement ICloneable's Clone() function, using Serialization. However, my code causes an exception. I have a class derived from TreeNode called "Node1". In Node1, I have implemented Clone() using serialization. When I call the Clone() function, the following exception is thrown at
0
2061
by: Henry | last post by:
Using ideas provided by some of you I was able to figure out how to get the names of the parameters fields of a crystal report specified at run time. The code below just basically puts the data into a comboBox. One thing I noticed, however, is that this method shows me both the parameters used by the main report and parameters used by the sub-report(s).
5
3150
by: Marcel Gelijk | last post by:
Hi, I am trying to create a User Control that is located in a seperate class library. The User Control contains a textbox and a button. The page generates an exception when it tries to access the code variable that are supposed to be linked to the contained controls. It runs fines when everything is contained in a single web form project. What do I need to do to make it work from a class library?
12
1766
by: Oleg Subachev | last post by:
I am moving from Delphi to C# and hve encountered the problem: I have the following classes and form Load event handler: public class class1 { public string S; public class1( string aS ) { S = aS;
0
945
by: Edward Diener | last post by:
I have a base class derived from System.Web.UI.Page, and derived classes derived from the base class. The base class has protected HTML hidden fields in it, and the derived class's aspx page has these hidden fields specified. So far everything is OK. However if I open the derived class's aspx page in the Web Form designer, it immediately puts an asterisk on the tab, meaning some change needs saving without my having done anything. If I...
2
4388
by: lewisms | last post by:
Hello all, I am quite new to c++/. Net so please don't shoot me down for being a newbie. Any way I am trying to make a simple multithreading program that is just to learn the ideas behind it (before I incorporate them in another program). I just can’t seem to get a non-static call to work in my thread that has access to the Form1 variables and controls I need. I can call a non-static function using another class but then I can seem to get in...
1
1107
tlhintoq
by: tlhintoq | last post by:
So I've created my own class SmartForm, derived from Form... public partial class SmartForm : Form It contains methods for things like remembering position, fading in or out, logging and so on. If I open the original SmartForm Visual Studio knows to open it in the right Forms Designer and I can add controls at design time. But, if I create a new form, and change it so it is derived from SmartForm... public partial class PicFrame :...
1
2218
by: =?Utf-8?B?Q2hyaXN0aWFuIFdlaW5lcnQ=?= | last post by:
Hello, I currently fight with a problem during the derivative of WinForm controls. In Visual Studio I created a new User Control. This control is derived from the DataGridView of the System.Windows.Forms namespace. I want to use this control as a template for futher controls. Within this control i want to set some property values to be pre-defined for further derived controls. My base class looks like this:
0
8059
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8495
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8145
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
6815
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6011
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5475
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4023
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1589
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1328
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.