I have been working on this for the greater part of the day and I cant seem to make this part of my code work. The intent of the code is to allow the user to input a set of values in order to calculate the missing value. As an additional feature I placed a CheckBox on the form to allow the user to do further calculation. That is where my problem lies. I know the code works because if I change the formula the value that appears in tb3_aic.Text changes per the formula. However, when I use the below the answer does not change like it should. Please reference the attached code. If a jpg image is needed of the formula I can e-mail it.
 void Calc3Click(object sender, EventArgs e)
    {
       if (String.IsNullOrEmpty(tb3_skv.Text) | String.IsNullOrEmpty(tb3_kva.Text) | String.IsNullOrEmpty(tb3_z.Text))
    {
        MessageBox.Show("Enter all required values", "Missing Data", MessageBoxButtons.OK);
    }   //If user does not enter all the values required for the calculation show error message box
    else
    {
        if (!String.IsNullOrEmpty(tb3_skv.Text) & !String.IsNullOrEmpty(tb3_kva.Text) & !String.IsNullOrEmpty(tb3_z.Text))
        { //If motor load check box is not checked and required values are entered calculate AIC based on formula.
            int y; 
            decimal x, z, a;
            x = decimal.Parse(tb3_skv.Text);      
            y = int.Parse(tb3_kva.Text);
            a = decimal.Parse(tb3_z.Text);
            z = (y * 1000) / (x * 1.732050808m) / (a / 100); //the m at the end of the decimal allows for the multiplication of decimals
            tb3_aic.Text = z.ToString();
            tb3_aic.Text = Math.Round(z,0).ToString();
        }
        if (cb3_ml.Checked==true) 
        {//If Motor Load CB is checked calculate the following
            int y, b;
            decimal x, z, a;
            x = decimal.Parse(tb3_skv.Text);
            y = int.Parse(tb3_kva.Text);
            a = decimal.Parse(tb3_z.Text);
            b = int.Parse(tb3_ml.Text);
            z = ((y * 1000) / (x * 1.732050808m) / (a / 100))+((b / 100)*(6*y)/(x*1.732050808m)*1000);
            tb3_aic.Text = z.ToString();
            tb3_aic.Text = Math.Round(z,5).ToString();
        }
     }
I am grateful for any help that can be provided.
Thank you, Greg Rutledge
 
     
     
     
     
    