Anna Hawks

Anna Hawks

  • NA
  • 243
  • 0

How's this Double.Parse statement work?!

May 13 2008 3:19 PM
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)