3
Answers

How's this Double.Parse statement work?!

Anna Hawks

Anna Hawks

16y
6.6k
1
I'm updating an old program (written in VS2003 and updating in VS2005) and found the following statement:

sql.Parameters.AddWithValue("@acheck", Double.Parse(txtAmtCheck.Text == "" ? "0.0" : txtAmtCheck.Text));

I'm assuming the intention was to substitute a zero if the textbox was blank -- based on the fact that I get the error that it can't enter a null into that field -- but it doesn't
 work now. I know I can say, "If tb == ""....", but I was just curious if anyone had seen anything like this before?
Answers (3)