From: Carlos on
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.


From: George Chen on
Hi Carlos,

1: Before a string be converted to a doule( or currency ) value, the
character, used as decimal or monetary decimal separator, should be found
out first.
please refer MSDN, GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_SDECIMAL,
..... or GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_SMONDECIMALSEP, ...

2a: then, parse the string to integer part and decimal part, and the sum
of two parts is your final answer.
2b: or, change the separator in the string to ".", and convert the new
string to a double ( or currency ) value.

George Chen

"Carlos" <ch_sanin(a)yahoo.com> wrote in message
news:OwMYc%23ZlIHA.5160(a)TK2MSFTNGP05.phx.gbl...
> 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.
>