title: Input string was not in a correct format
body: <p>I'm new with C#, I have some basic knowledge in Java but I can't get this code to run properly.</p>
  
  <p>It's just a basic calculator, but when I run the program VS2008 gives me this error:</p>
  
  <p><img src="https://i.stack.imgur.com/yWpBd.png" alt="Calculator"></p>
  
  <p>I did almost the same program but in java using JSwing and it worked perfectly.</p>
  
  <p>Here's the form of c#:</p>
  
  <p><img src="https://i.stack.imgur.com/u26pk.png" alt="Form"></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.Windows.Forms;
  
  namespace calculadorac
  {
      public partial class Form1 : Form
      {
  
      int a, b, c;
      String resultado;
  
      public Form1()
      {
          InitializeComponent();
          a = Int32.Parse(textBox1.Text);
          b = Int32.Parse(textBox2.Text);
      }
  
      private void button1_Click(object sender, EventArgs e)
      {
          add();
          result();
      }
  
      private void button2_Click(object sender, EventArgs e)
      {
          substract();
          result();
      }
  
      private void button3_Click(object sender, EventArgs e)
      {
          clear();
      }
  
      private void add()
      {
          c = a + b;
          resultado = Convert.ToString(c);
      }
  
      private void substract()
      {
          c = a - b;
          resultado = Convert.ToString(c);
      }
  
      private void result()
      {
          label1.Text = resultado;
      }
  
      private void clear()
      {
          label1.Text = "";
          textBox1.Text = "";
          textBox2.Text = "";
      }
  }
  </code></pre>
  
  <p>What can be the problem? Is there a way to solve it?</p>
  
  <p>PS: I also tried</p>
  
  <pre><code>a = Convert.ToInt32(textBox1.text);
  b = Convert.ToInt32(textBox2.text);
  </code></pre>
  
  <p>and it didn't work.</p>