473,395 Members | 1,774 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Convert.ToDouble problem

does anybody know how to change the global IFormatProvider of my project so
everycall to Convert.ToDouble on it uses this format provider instead of the
one the one on the computer's regional configuration
Sep 26 '05 #1
4 3501
Hi Irepan,

Convert.ToDouble uses the NumberFormatInfo of the CurrentCulture. If you change this CultureInfo you won't have to specify a IFormatProvider for eavh Convert.
On Mon, 26 Sep 2005 21:00:01 +0200, Irepan <Ir****@discussions.microsoft.com> wrote:
does anybody know how to change the global IFormatProvider of my project so
everycall to Convert.ToDouble on it uses this format provider instead of the
one the one on the computer's regional configuration


--
Happy coding!
Morten Wennevik [C# MVP]
Sep 27 '05 #2
Irepan,
does anybody know how to change the global IFormatProvider of my project
so
everycall to Convert.ToDouble on it uses this format provider instead of
the
one the one on the computer's regional configuration


Can you tell us to learn, why you want to do this?

Cor
Sep 27 '05 #3
sure i can, as a matter of fact i find an easy solution for this using
Thread.CurrentThread.CurrentCulture = new CultureInfo(blabla) but i need it
for PDA and CurrentCulture doesn't exists on CurrentThread's properties for
Compact framework, but anyway, the problem that i have is that when i
programmed my PDA application i used Convert.ToDouble(aString) to convert the
strings i get from the GPS to know a location so usually if i have a string
"134.523453" my double value will be 134.523453 that worked fine and i have
this kind of conversion all over my application's source, the problem is when
i use a PDA with a different Region information for instance spanish
(international) which have the decimal point set to a colon "," and the
separators as points "." then at those PDA's the function will get me a value
of 134523453 instead of the 134.523453 that i need.

"Cor Ligthert [MVP]" wrote:
Irepan,
does anybody know how to change the global IFormatProvider of my project
so
everycall to Convert.ToDouble on it uses this format provider instead of
the
one the one on the computer's regional configuration


Can you tell us to learn, why you want to do this?

Cor

Sep 28 '05 #4
Irepan,

If I resume, the GPS is giving you a string in the English language style
setting and because that the culture setting in your system is in the style
of most other languages it will be wrong converted.

Interesting problem.

Maybe can you use this one. It is supported by the CompactFramework and
seems for me for your problem.

http://msdn.microsoft.com/library/de...lturetopic.asp

I hope this helps,

Cor

"Irepan" <Ir****@discussions.microsoft.com> schreef in bericht
news:B5**********************************@microsof t.com...
sure i can, as a matter of fact i find an easy solution for this using
Thread.CurrentThread.CurrentCulture = new CultureInfo(blabla) but i need
it
for PDA and CurrentCulture doesn't exists on CurrentThread's properties
for
Compact framework, but anyway, the problem that i have is that when i
programmed my PDA application i used Convert.ToDouble(aString) to convert
the
strings i get from the GPS to know a location so usually if i have a
string
"134.523453" my double value will be 134.523453 that worked fine and i
have
this kind of conversion all over my application's source, the problem is
when
i use a PDA with a different Region information for instance spanish
(international) which have the decimal point set to a colon "," and the
separators as points "." then at those PDA's the function will get me a
value
of 134523453 instead of the 134.523453 that i need.

"Cor Ligthert [MVP]" wrote:
Irepan,
> does anybody know how to change the global IFormatProvider of my
> project
> so
> everycall to Convert.ToDouble on it uses this format provider instead
> of
> the
> one the one on the computer's regional configuration


Can you tell us to learn, why you want to do this?

Cor

Sep 28 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: cindy liu | last post by:
Hi, In .Net, how to convert a string to a double? Thanks in advance! Cindy
4
by: aevans1108 | last post by:
expanding this message to microsoft.public.dotnet.xml Greetings Please direct me to the right group if this is an inappropriate place to post this question. Thanks. I want to format a...
10
by: | last post by:
Hey I am calling Convert.ToDouble(someString); But this double can have to ways or representing doubles dependant on the locale, it can be 1.0 or 1,0 Is there a way to make...
3
by: user | last post by:
Hello i have problems with this function, always thru exception for all data, for example: Convert.ToDouble("545.0"). Why ? I want to convert string data in different format into double, i have...
4
by: Daniel Walzenbach | last post by:
Hi, I wonder if somebody could explain me the difference between Double.Parse and Convert.ToDouble. If I'm not mistaken they are implemented differently (I though for a moment they might be the same...
2
by: Jason | last post by:
In VB.NET, when I use System.Convert.ToDouble(string Val) to convert a string variable to double variable, I got something interesting: Dim stringVal As String = "101.01" Dim doubleVal As Double...
4
by: Irepan | last post by:
does anybody know how to change the global IFormatProvider of my project so everycall to Convert.ToDouble on it uses this format provider instead of the one the one on the computer's regional...
3
by: mrajanikrishna | last post by:
Hi Friends, I am accepting a number from the user entered in a textbox. I want to assign to a variable in my code and assignt this to that variable. double num1 = (double)txtNum1.text; ...
4
by: Yoavo | last post by:
Hi, I want to convert a string to double. I use the function: "System.Convert.ToDouble". The problem is that if the string contains the character "." the program aborts. What might be the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.