private void btnEq_Click(object sender, EventArgs e) { lblError.Text = ""; if (M != null) { if (M.B != null) { M.A = txtDisplay.Text; //populates first holder to do math. The secondary holder was populated by clicking a operator. lblN.Text = lblN.Text + " " + txtDisplay.Text + " = "; // updates the math label at the top of the form //txtDisplay.Text = M.nMath().ToString(); //class method to do the math and to updated the form textbox Double xMath = M.nMath(Double.Parse(M.A), Double.Parse(M.B), M.Operation); if (double.IsInfinity(xMath)) { lblError.Text = "Cannot divide by zero"; txtDisplay.Text = xMath.ToString(); } else { txtDisplay.Text = xMath.ToString(); } M.B = null; trackCelc = true; } } }