double validateAndOperate() { Interest_calc calc=new Interest_calc(); decimal number; double principle, rate, time,interest_temp; if((Decimal.TryParse(textBoxPrinciple.Text,out number))&&(Decimal.TryParse(textBoxRate.Text, out number))&& (Decimal.TryParse(textBoxTime.Text, out number))) { principle = Convert.ToDouble(textBoxPrinciple.Text); rate = Convert.ToDouble(textBoxRate.Text); time = Convert.ToDouble(textBoxTime.Text); calc.Principle = principle; calc.Rate = rate; calc.Time = time; interest_temp = calc.interest_amount_calc(); } else { { interest_temp = -1; } } return interest_temp; }
double validateAndOperate() { Interest_calc calc = new Interest_calc(); decimal number; double principle, rate, time, interest_temp; if ((Decimal.TryParse(textBoxPrinciple.Text, out number)) && (Decimal.TryParse(textBoxRate.Text, out number)) && (Decimal.TryParse(textBoxTime.Text, out number))) { principle = Convert.ToDouble(textBoxPrinciple.Text); rate = Convert.ToDouble(textBoxRate.Text); time = Convert.ToDouble(textBoxTime.Text); calc.Principle = principle; calc.Rate = rate; calc.Time = time; interest_temp = calc.interest_amount_calc(); } else { { interest_temp = -1; } } return(interest_temp); }