Hi all,The scenario is this:I have a .aspx webform, with code behind to handle data entered by user, most fields are in double.At business layer, at other class, let say there is a function: public SaveData(value1 As double, value2 As double) as BooleanThus, when I call the function at code behind:SaveData(txtDouble.txt, txtDouble2.txt)The problem is when there is a empty text, it will throw an exception invalid cast to double value.Thus, I should change it to:Double value1 = 0.0
Double value2 = 0.0
double.TryParse(txtDouble.txt, out value1)
double.TryParse(txtDouble2.txt, out value2)
I just wondering whether this is the correct way of writing it? And if I have more than 20 fields of double value, then I should declare additional 20 double value?Your input is much appreciated.Cheers!
View Complete Post