Calculate values in unfilled spaces in Form

0

Good afternoon!

I'm hesitant to implement an algorithm that can calculate the heat flow based on the formulas:

q = ΔT / Rt
ΔT = Initial temperature-Final temperature
Rt (thermal resistance) = L (Thickness) / K (retentivity) * A (area-m²)

All have textbox and would like to create a logical condition that if an unfilled field or program reports in the textbox the calculation performed. Here is an example that I did but did not run the second condition.

//calcula q=ΔT/Rt


if (txt_Resist.Text.Trim() != null && delta_temp.Text.Trim() != null)
        {
            decimal q;
            q = Fluxo_Calor(Convert.ToDecimal(delta_temp.Text.ToString()), Convert.ToDecimal(txt_Resist.Text.ToString()));

                 //informa o valor de q no textbox do resultado

                     txtResultado.Text = q.ToString();
        }
        //Calcula Q=(Temperaturaincial-Temperaturafinal)/Rt
        else if (txt_Resist.Text.Trim() != null && txt_delta1.Text.Trim() != null && txt_delta2.Text.Trim() != null)
        {
            decimal delta, q;

            delta = Deltatemperatura(Convert.ToDecimal(txt_delta1.Text.ToString()), Convert.ToDecimal(txt_delta2.Text.ToString()));
            //Retorna o valor de delta no textbox
            delta_temp.Text = delta.ToString();

                            //informa o valor de q no textbox do resultado
            q = Fluxo_Calor(delta, Convert.ToDecimal(txt_Resist.Text.ToString()));
            txtResultado.Text = q.ToString();}

    
asked by anonymous 25.06.2017 / 19:23

0 answers