title: How can I dynamically grow a form vertically and move a textbox down the proper amount?
body: <p>I have a label and a textBox on a form. The content of the label is dynamic and could overflow its bounds onto the textbox below it. I want to dynamically increase the height of the form and the top of the textBox as appropriate so that the label contents "push" the textbox down on the form. By setting the label to Autosize and giving it a maximum width, I want to allow it to grow horizontally only to the right edge of the form bu then vertically (downwards) as much as it needs to.</p>
  
  <p>My code for attempting this is:</p>
  
  <pre><code>int bottomOfLabel = label1.Location.X + label1.Size.Height;
  int topOfTextBox = textBox1.Location.Y;
  int currentHeightOfForm = this.Size.Height;
  int currentTopOfTextBox = texBox1.Location.Y;
  
  if (bottomOfLabel &gt;= topOfTextBox)
  {
      int heightToAdd = bottomOfLabel - topOfTextBox;
      this.Size.Height = currentHeightOfForm + heightToAdd;
      textbox.Location.Y = currentTopOfTextBox + heightToAdd;
  }
  </code></pre>
  
  <p>...but I'm getting these errors:</p>
  
  <p><em>Cannot modify the return value of 'System.Windows.Forms.Form.Size' because it is not a variable</em>   </p>
  
  <p>-and:</p>
  
  <p><em>Cannot modify the return value of 'System.Windows.Forms.Control.Location' because it is not a variable</em></p>
  
  <p>So how can I accomplish this?</p>