D
Daniel Moth
Hi
This is reproducible on our own 4.2 based device as well as in the
emulator.. with SP1 or the current SP2 beta... Haven't tried on a PocketPC
maybe someone else can please(?)
When the locale is set to something like French (where decimal separators
are commas and not dots) calling Val("23.45") throws a
System.FormatException... Note that the same function call on the desktop
works as expected and as documented (i.e. The Val function recognizes only
the period (.) as a valid decimal separator)
Interestingly passing "23,45" to it returns 23,00... which is correct (Val
stops converting at the first character that cannot be interpreted as a
numeric digit, numeric modifier, numeric punctuation, or white space.)
I had a quick look with Anakrino on the desktop and cf implementations of
Microsoft.VisualBasic.Conversion.Val(string) and they seem identical except
they both call HexOrOctValue which have slight differences... Any ideas?
In the meantime since C# does not have an equivalent maybe someone has
written a handy function I could use until it gets fixed...(?)
Cheers
Daniel
PS In case the repro line of code was not clear just execute the
following when the locale is set to French...
MessageBox.Show(Microsoft.VisualBasic.Conversion.Val("34.3").ToString())
This is reproducible on our own 4.2 based device as well as in the
emulator.. with SP1 or the current SP2 beta... Haven't tried on a PocketPC
maybe someone else can please(?)
When the locale is set to something like French (where decimal separators
are commas and not dots) calling Val("23.45") throws a
System.FormatException... Note that the same function call on the desktop
works as expected and as documented (i.e. The Val function recognizes only
the period (.) as a valid decimal separator)
Interestingly passing "23,45" to it returns 23,00... which is correct (Val
stops converting at the first character that cannot be interpreted as a
numeric digit, numeric modifier, numeric punctuation, or white space.)
I had a quick look with Anakrino on the desktop and cf implementations of
Microsoft.VisualBasic.Conversion.Val(string) and they seem identical except
they both call HexOrOctValue which have slight differences... Any ideas?
In the meantime since C# does not have an equivalent maybe someone has
written a handy function I could use until it gets fixed...(?)
Cheers
Daniel
PS In case the repro line of code was not clear just execute the
following when the locale is set to French...
MessageBox.Show(Microsoft.VisualBasic.Conversion.Val("34.3").ToString())