title: Quadratic equation formula
body: <p>I am trying to make a program that calculates the answer of a quadratic equation with the general formula but i am encountering a few errors.
  The way I have my Windows Form Application set up it asks for a, b, and c, and substitutes them in the general formula.
  I have 3 text boxes, one for each value of a, b and c and one more for the answer, and it is supposed to work with a button I called "calculate". 
  My problem is that when I try something other than a perfect trinomial square, the answer comes up as NaN.
  Here is some of the code I have:</p>
  
  <pre><code>private void textBox1_TextChanged(object sender, EventArgs e)
      {
          a = Double.Parse(textBox1.Text);
      }
  </code></pre>
  
  <p>^ This is how I am assigning values to the variables</p>
  
  <pre><code>double sqrtpart = b * b - 4 * a * c;
          answer = (b + Math.Sqrt(sqrtpart)) / 2 * a;
          textBox4.Text = answer.ToString();
  </code></pre>