473,320 Members | 2,088 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,320 software developers and data experts.

CultureInfo

Hi

I've been taken by surprise when I realized that MyDouble.ToString()
actually formats the string based on the local settings of the machine it
was installed on (rather than using InvariantCulture settings by default).
This represents a problem for my app, since this data is converted back to
doubles at some later stage and since the client and the server may have
different regional settngs.

Is there a way to set the culture in an application 'globally', rather the
using MyDouble.ToString(System.Globalization.CultureInfo .InvariantCulture)
all over the place?

Thanks for any hints.

Urs
Nov 20 '05 #1
2 1559
Urs,
You can set System.Threading.Thread.CurrentThread.CurrentCultu re to the
culture that you want, ToString will then use that.

For an example see:
http://msdn.microsoft.com/library/de...matstrings.asp

You may also want to review System.Globalization.CultureInfo for properties
& methods to get a possibly more granular change...

Hope this helps
Jay

"Urs Vogel" <uv****@msn.com> wrote in message
news:Og**************@TK2MSFTNGP09.phx.gbl...
Hi

I've been taken by surprise when I realized that MyDouble.ToString()
actually formats the string based on the local settings of the machine it
was installed on (rather than using InvariantCulture settings by default).
This represents a problem for my app, since this data is converted back to
doubles at some later stage and since the client and the server may have
different regional settngs.

Is there a way to set the culture in an application 'globally', rather the
using MyDouble.ToString(System.Globalization.CultureInfo .InvariantCulture)
all over the place?

Thanks for any hints.

Urs

Nov 20 '05 #2
Jay

Wasn't aware of thread related culture settings. The current thread works
fine for me, and since I use the thread pool with very few generic API
methods, it's fairly easy to control.

Thanks, Urs.
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> schrieb im
Newsbeitrag news:uT*************@TK2MSFTNGP11.phx.gbl...
Urs,
You can set System.Threading.Thread.CurrentThread.CurrentCultu re to the
culture that you want, ToString will then use that.

For an example see:
http://msdn.microsoft.com/library/de...matstrings.asp
You may also want to review System.Globalization.CultureInfo for properties & methods to get a possibly more granular change...

Hope this helps
Jay

"Urs Vogel" <uv****@msn.com> wrote in message
news:Og**************@TK2MSFTNGP09.phx.gbl...
Hi

I've been taken by surprise when I realized that MyDouble.ToString()
actually formats the string based on the local settings of the machine it was installed on (rather than using InvariantCulture settings by default). This represents a problem for my app, since this data is converted back to doubles at some later stage and since the client and the server may have
different regional settngs.

Is there a way to set the culture in an application 'globally', rather the using MyDouble.ToString(System.Globalization.CultureInfo .InvariantCulture) all over the place?

Thanks for any hints.

Urs


Nov 20 '05 #3

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

Similar topics

2
by: choyk1 | last post by:
Hi all, I cannot serialize CultureInfo property as below. It invokes InvalidOperationException. public class One { private CultureInfo culture;
1
by: tommys | last post by:
Hi, I thought that using CultureInfo.CurrentUICulture would give me the current date format as set in the OS - but it did not work that way :-( When re-reading the docs I can see why: "Gets the...
0
by: Maileen | last post by:
Hi, I wrote in VB a small application which save old culture info before to change them for running Excel macro. It looks like that : Dim oldCI As System.Globalization.CultureInfo = _...
1
by: rerdavies | last post by:
OS: WIndows Server 2003. Currently logged in user is running with German(German) regional settings. Code fragment: System.Globalization.CultureInfo culture = new...
4
by: John A Grandy | last post by:
what's the full class hierarchy for the CultureInfo object in effect by default ?
8
by: G.Ashok | last post by:
Hi, I have created CultureInfo object and specified required digit grouping in it. The one of the overloaded ToString methods of Decimal type has parameters to format the value with required...
2
by: Giorgio | last post by:
I would to format the date in Italian ...(dd/mm/yyyy) I have set an another language in International setting(for test i have set Lettonia) The format date for this nation is yyyy.mm.dd ... I...
4
by: Dirk Behnke | last post by:
How can I start a new process with a different CultureInfo? I have tried already to set the CultureInfo of the thread starting the new process before creating the Process object, but it doesn't...
8
by: Phil Jollans | last post by:
Hi, I am having difficulty overriding the ToString() method of CultureInfo using Visual Studio 2005. Exactly the same code works fine with Visual Studio .NET 2003. What I am doing is adding...
8
by: =?Utf-8?B?T2xpdmllciBHSUw=?= | last post by:
Hello, I try to convert a volume stored as a string value in an XML file into a Decimal object. The volume is stored with comma as decimal separator ("210,12") according to french habits. To be...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.