double.Parse
will use the current thread's culture by default. I suspect your current culture uses "." as a grouping separator.
Two options:
- Continue to use
Replace
as you are already doing, but then specifyCultureInfo.InvariantCulture
when parsing - Remove the replacement, and just use the current thread's culture when parsing the original value. This relies on the culture being appropriate for the user, but is probably a better solution when that's the case. (Otherwise someone entering "1,234.56" will get a parse error when they expected a value of "just a bit more than 1234".)