The following example overrides the AppendSubBuilder method to throw an Exception if the control this control builder is applied to tries to include controls in its instance of ControlCollection class.
// Override the AppendSubBuilder method to throw an// exception if the class it is applied to attempts// to include child controls. publicoverridevoid AppendSubBuilder(ControlBuilder subBuilder)
"A custom label control cannot contain other objects.");
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2