title: Putting values of an array into text boxes using C#
body: <p>I've created a dimensional array using two <code>for</code> loops, and as each inner loop completes, I'd like those values to go into textboxes on a windows form.  (I realize that the values will be overwritten each time, with just the values from the final outer loop showing at the end.)</p>
  <p>The comments in the code show what I've been trying to get to work.</p>
  <p>Thanks!</p>
  <pre class="lang-cs prettyprint-override"><code>if (IsValidData())
  {
      int Columns = 5;
      int Rows = Convert.ToInt32(txtNumbDrawings.Text);
      
      int[,] ball = new int[Columns, Rows];
  
      for (int i = 0; i &lt; Rows; i++)
      {
          List&lt;int&gt; ballsList = new List&lt;int&gt;();
          int[] txtBall = new int[Columns];
  
          for (int j = 0; j &lt; Columns; j++)
          {
              Random number = new Random();
              ball[i, j] = number.Next(1, 70);
              
              // prevent duplicate numbers
              while (ballsList.Contains(ball[i, j] ))
              {
                  ball[i, j] = number.Next(1, 70);
              }
              
              ballsList.Add(ball[i, j]);
  
              /*************************************************
               * how do I get the current ball value
               * into a textbox on a form?
               * 
               * textboxes are named txtBall1, txtBall2, etc...
               * 
               * I was trying something like:
               * 
               * TextBox[] txtBall = new TextBox[5];
               * for (int i = 0; i &lt; 5; i++)
               * {
               *      txtBall[i + 1].Text = ball[i, j].ToString();
               * }
               *************************************************/
          }
  
          ballsList = null;
      }
  }
  
  Windows Form Image:  https://1drv.ms/u/s!Ak6hxvO3Ye6Oj5I9NQy834Yk4TRLyw?e=DniwK8
  </code></pre>