title: Making controls on a date
body: <p>I'm trying to insert a date on a textbox and making controls (for example don't let the user to put a date which has still to come) but it throws an exception</p>
  
  <pre><code>string[] array = txtData.Text.Split('/');
  int[] arrayint = new int[3];
  arrayint[0] = Convert.ToInt32(array[0]);
  arrayint[1] = Convert.ToInt32(array[1]);
  arrayint[2] = Convert.ToInt32(array[2]);
  try
  {
      if (arrayint[0] &gt; 0 &amp;&amp; arrayint[0] &lt; 32)
      {
          if (arrayint[1] &gt; 0 &amp;&amp; arrayint[1] &lt; 13)
          {
              if (DateTime.Compare(DateTime.Today, Convert.ToDateTime(txtData.Text)) &lt;= 0)
              {
                  string s = txtTitolo.Text + ", " + txtData.Text + ", " + txtDim.Text + ", " + txtFormato.Text + ", " + txtRisoluzione.Text;
                  listVideo.Items.Add(s);
              }
          }
      }
  }
  catch (Exception)
  {
      MessageBox.Show("data non valida");
  }
  </code></pre>
  
  <p>Thank you to everyone who will answer</p>