title: How to check all textboxes inside a splitcontainer?
body: <p>My program uses a split container which both panels 1 &amp; 2 have text boxes. I am trying to run a check when the program is attempting to close that prompts users to save. I tried the following code but it doesn't seem to work since the text boxes are within a splitcontaier (just guessing).</p>
  
  <pre><code>private void button1_Click(object sender, EventArgs e)
      {
          foreach ( TextBox tb in this.Controls.OfType&lt;TextBox&gt;()) 
          {
              tb.Text = "Save";
  
          }
      }
  </code></pre>
  
  <p>When I use the bit of code on a program that has text boxes within the form itself, it works. When I try to use it where the textboxes are within panels it does not. It also doesn't work if I use code specifying the splitcontainer</p>
  
  <pre><code>  foreach ( TextBox tb in splitContainer1.Controls.OfType&lt;TextBox&gt;()) 
         {               
             tb.Text = "Save";
          }
  </code></pre>
  
  <p>How can I get it to address the textboxes within the splitcontainer?</p>
  
  <p>I can specify the text boxes within a specific panel and do them each 1 at a time:</p>
  
  <pre><code>//this works, but only populates those text boxes in panel1
  foreach ( TextBox tb in splitContainer1.Panel1.Controls.OfType&lt;TextBox&gt;() ) 
         {               
             tb.Text = "save";
          }
  </code></pre>
  
  <p>But I still can't seem to do this in 1 test. I'm having to check both panel independently. </p>