title: Loop through text boxes within tab controls
body: <p>I have a winforms app which has to extract text from 50 text boxes found in different tabs and panels. So far i have been unable to find something that works.
  I have tried:</p>
  
  <pre><code>foreach (Control x in this.Controls)
  {
      if (x is NumericTextBox)
      {
         s = i.ToString() + ", " + ((NumericTextBox)x).Text;
         Append_to_Template_File(s);
         i++;
      }
  } 
  </code></pre>
  
  <p>But this only goes through the textboxes on the form
  I have also found this answer, however I have not managed to make it work:
  <a href="https://stackoverflow.com/questions/4863051/loop-through-textboxes">Loop through Textboxes</a>
  The top answer results in a number of error:</p>
  
  <blockquote>
    <ol>
    <li>Constraints are not allowed on non-generic declarations</li>
    <li>The type or namespace name 'TControl' could not be found</li>
    </ol>
  </blockquote>
  
  <p>I'm new at using C# and i'm not quite sure how to solve the first error. If it helps, i'm using Visual Studio 2008 and .NET 3.5
  Any suggestions?</p>