title: Auto-position nested UserControls
body: <p>I want to autosize some generated controls.  I create two <code>TextBox</code> types and two <code>CustomControl</code> types which are a type of <code>UserControl</code>.  Each <code>CustomControl</code> has a <code>Label</code> that displays a string which I call a caption.  I can only see one of the two textboxes.  I can only see one of the two captions.  How can I display all the Controls in the Form?  I prefer not to manage control position's myself.  Rather stick to <code>Dock</code> settings.</p>
  
  <pre><code> public partial class SomeForm : Form
  {
      public SomeForm()
      {
          InitializeComponent();
          LoadControls();//I can only see the first control caption and textBox2
          //how can I display both textboxes and both captions?
      }
  
      private void LoadControls()
      {
          TextBox textBox = GenerateTextBox("First textbox");
          TextBox textBox2 = GenerateTextBox("Second textbox");
  
          CustomControl control = new CustomControl(labelCaption: "First control caption");
          CustomControl control2 = new CustomControl(labelCaption: "second control caption");            
  
          //add the textboxes to the usercontrols
          control.Controls.Add(textBox);
          control2.Controls.Add(textBox2);            
  
          //this displays only 1 control (incorrect)
          flowLayoutPanel1.Controls.Add(control);
          flowLayoutPanel1.Controls.Add(control2);
          flowLayoutPanel1.SetFlowBreak(control, true);
          flowLayoutPanel1.SetFlowBreak(control2, true);
  
          //this displays both controls (correct)
          //flowLayoutPanel1.Controls.Add(textBox);
          //flowLayoutPanel1.Controls.Add(textBox2);
          //flowLayoutPanel1.SetFlowBreak(textBox, true);
          //flowLayoutPanel1.SetFlowBreak(textBox2, true);
      }
  
      private static TextBox GenerateTextBox(string text)
      {
          TextBox textBox = new TextBox();
          textBox.Text = text;
          textBox.Dock = DockStyle.Top;
          return textBox;
      }
  }
  </code></pre>
  
  <p>CustomControl:</p>
  
  <pre><code>    public CustomControl(string labelCaption)
      {
          InitializeComponent();
          Label label = new Label();
          label.Text = "Rtb..." + labelCaption;
          //label.Dock = DockStyle.Top;
          //contentPanel.Controls.Add(label);//disabled for now
      }
  </code></pre>