title: Take input from textBox2.text and int.Parse
body: <p>When I press the result button it returns an error instead of checking if the condition is OK or not.  It exits with the following error:</p>
  <blockquote>
  <p>An unhandled exception of type 'System.FormatException' occurred in mscorlib.dll</p>
  <p>Additional information: Input string was not in a correct format.</p>
  </blockquote>
  <p>I'm trying to take input from the user and change it to an <code>int</code> in <code>textBox2</code>. Why does the application exit with an error?</p>
  <pre><code>    private void button1_Click(object sender, EventArgs e)
      {
          string name = &quot;textBox1.Text&quot;;
          int qty = int.Parse(textBox2.Text);
         
          if (textBox1.Text.Length == 0 ||  qty == 0)
          {
              MessageBox.Show(&quot;Please enter Values&quot;);
          }
          else {
              MessageBox.Show(&quot;Thank You&quot;);
          }
      }
  </code></pre>