title: Add each row from text file in separate textboxes in C#
body: <p>I have 30+ TextBoxes in my application and I would like to add, in order, each row of the text file in each textbox.</p>
  
  <pre><code>private void button2_Click(object sender, EventArgs e)
  {
      if (path1 != null &amp;&amp; Directory.Exists(path1))
      {
          var lines = File.ReadAllLines(path1);
          foreach (var line in lines)
          {
              //what is here ?
          }
      }
  }
  </code></pre>
  
  <p>So, if I have in my text file:<br>
   - dog<br>
   - computer<br>
   - money  </p>
  
  <p>I would like to have in: </p>
  
  <ul>
  <li><strong>textbox1</strong> the <strong>first row</strong> (dog)  </li>
  <li><strong>textbox2</strong> the <strong>second row</strong> (computer)  </li>
  <li><strong>textbox3</strong> the <strong>third row</strong> (money)  </li>
  </ul>
  
  <p><strong>Update:</strong> Added a list of <code>TextBoxes</code>. Now, how can I access one textbox at a time and use it in <code>foreach</code> ?</p>
  
  <pre><code>private void button2_Click(object sender, EventArgs e)
  {
      List&lt;TextBox&gt; textBoxes = new List&lt;TextBox&gt;();
  
      for (int i = 1; i &lt;= 37; i++)
      {
          textBoxes.Add((TextBox)Controls.Find("textBox" + i, true)[0]);
      }
  
      if (path1 != null &amp;&amp; Directory.Exists(path1))
      {
          var lines = File.ReadAllLines(path1);
          foreach (var line in lines)
          {
              //what is here ?
          }
      }
  }
  </code></pre>