quinta-feira, abril 13, 2006

PRB: Convert String to Double

I detect a problem when deployed a project into Server client.

The Product Purchase Price was 2,99€ but the server was converting it into 299€.

I Change the "Regional Setting" for (,) instead of (.), but doesn't solve the problem.

To solve the problem i change all CDBL(valueStr.Replace(".", ",")) calls by:

Double.Parse(valueStr.Replace(".", ","), New System.Globalization.CultureInfo("pt-PT", False).NumberFormat)

The Double value appeares correctly. And the Parameter Value [False], force the CultureInfo to assume "pt-PT" even if user have another configuration in "Regional Settings"

Regards
Paulo Pires

Sem comentários: