title: Array of random numbers in C# / .NET framework
body: <p>I am trying to create a lottery program that would generate random  numbers between 1 - 35. These numbers need to be unique as well, they can not be the same. With C#, running on the .NET framework.</p>
  <p>I have been trying to get it to work, but I keep getting errors and I don't understand why. I have been googling and looking at videos - still I don't get what I am doing wrong.</p>
  <p>This is my code:</p>
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using System.Windows.Forms;
  
  namespace help
  {
      public partial class Form1 : Form
      {
          // The array 
          TextBox[] TextBoxArray;
      
          // the counter on how many times u pressed btn 
          private int counter = 1;
  
          public Form1()
          {
              InitializeComponent();
  
              this.StartPosition = FormStartPosition.CenterScreen;
              // The text boxes name 1 - 7 
              //TextBoxArray = new TextBox[] { Nr1, Nr2, Nr3, Nr4, Nr5, Nr6, Nr7 };
          }
  
          private void button1_Click(object sender, EventArgs e)
          { 
              NrOfPull.Text = counter.ToString();
              counter++;
  
              // Keep getting an error 
              // Error CS0443   Syntax error; value  
              // they are talking about the Parse(TextBoxArray[].Text); 
              int number = int.Parse(TextBoxArray[].Text);
  
              // Loop through 
              Random rand = new Random();
  
              for (int i = 0; i &lt; number; i++)
              {
                  // Generate a alotter by turn 
                  int storedNumber;
                  int[] randomLottoRow = new int[7];
  
                  for (int row = 0; row &lt; 7; row++)
                  {
                      do
                      {
                          storedNumber = rand.Next(1, 35);
                      }
                      while (randomLottoRow.Contains(storedNumber));
  
                      randomLottoRow[row] = storedNumber;
                  }}
  
              /*
               *  This will only let me generate numbers.. but wanna use Parse...  
             
              Random generator = new Random();
              for (int x = 0; x &lt; 7; x++)
              {
                  TextBoxArray[x].Text = generator.Next(1, 35).ToString();
                  Console.WriteLine(TextBoxArray[x].Text = generator.Next(1, 35).ToString());
  
              }
              */
  
          }
      }
  }
  </code></pre>
  <p>Would love to get feedback on what I am doing wrong Thank you so much :)</p>