Converting to a double number for a different culture format

  • Thread starter Thread starter Carlos
  • Start date Start date
C

Carlos

Hi all,

I have a small app running in a Pocket PC that converts a value in a
textbox to
a double. The problem is that when the value is converted in a device that
has
the comma (',') as a decimal point, the value is converted wrongly. i.e.
(1,9 gets converted as 19.0 instead of 1.9). How to make sure that
this value is converted to the proper double value number, and how to test
it successfully?

Thanks,

Carlos.
 
Hi,

You could do this:

using System.Globalization;

....

double x = double.Parse(textBox.Text, CultureInfo.InvariantCulture);

Regards.
 
Thank you German!

I did so. However how can I test by using a different culture other than
the default?

Thanks again!,

Carlos.
 
Back
Top