I think you have the correct answer from OriginalGriff; if you want to see some previous discussion of this issue here on CodeProject:
July 2009 CP article: "Designing Nested Controls" by Henry Minute: [
^].
July 2011 CP Tip/Trick: "DesignTime adding of Controls to a UserForm on a WinForm" by Bill Woodruff: [
^]
What many people do not realize (pointed out in my 2011 Tip) is that by use of that simple Attribute before a UserControl's Class definition you can enable nesting ... to any depth ... of Controls, and other UserControls, inside the modified UserControl.
Yes, you can even have nested instances of the modified UserControl itself inside the modified UserControl.
However, the question arises: do you really want to take advantage of such "freedom:" does use of this type of nesting of Controls result in good OO design, given your task at hand, and the possible issues of future maintenance of your code ?
All the Controls you may have added to an
instance of a UserControl on a Form at design-time remain "bound" to the application you are creating: i.e., they are not re-usable.
If you want your modified UserControl to be re-usable: I propose you consider (the slow and steady approach ?):
1. define your "base" UserControl
2. as the need arises to create other variants of the base UserControl: create a new UserControl, and make it inherit from the base UserControl.
If you do this, note:
1. Any Controls on the base UserControl will now, of course, appear on the inherited UserControl, but they will be locked.
If you have Button on UserControl1 with a Click EventHandler, and you then sub-class UserControl1 to create UserControl1a: a Click on the Button in UserControl1a will fire the Click EventHandler in UserControl1.
2. If the base UserControl was decorated with the Attribute that allows it function as a Container at design-time, the inherited UserControl will also have that ability: no need to also write that Attribute in the inherited UserControl.
3. as you might expect, you can add new Controls of any Type to the inherited UserControl, and they do not affect the base UserControl in any way.