I want to obtain a total of three values:
when none of the values is null, the total calculates successfully but when one or more of the values is null,
it returns an error.
"input string was not in correct format"
Below is the code:
double TotalVar = double.Parse(ExScore.Tables[0].Rows[i]["CAT1"].ToString()) +
double.Parse(ExScore.Tables[0].Rows[i]["CAT2"].ToString()) +
double.Parse(ExScore.Tables[0].Rows[i]["CAT3"].ToString()) +
double.Parse(ExScore.Tables[0].Rows[i]["EXAM"].ToString());
Aucun commentaire:
Enregistrer un commentaire