Localization - temp changing of decimal separator?

chrisbwy

Member
Joined
Aug 15, 2005
Messages
13
Programming Experience
Beginner
Hi All,

Is there a way of temporarily changing the Regional Settings decimal separator from say a comma "," if the user sets Spain for example to a period "."?

I have a 3rd party control that is fixed to use a perod.

I think I could maybe use double.parse(data1, NumberFormatInfo) to convert the double data1 to replace the comma with a period provided I first define the NumberFormatInfo decimal separator to be a period.

Any ideas?

Please don't suggest converting the data1 to a string then replacing the "," with a "."

Tried that and Windows Regional Settings knows data1 is a double and changes it back when I send data1 to the 3rd party control.

Help!

Chris
 
Here is what I have found in the local help:

To set formatting options appropriate for a specific culture

1. If you want to override the settings of the user or operating system, set the CurrentCulture and CurrentUICulture properties.
Usually, you want to specify a culture so that every part of the application's UI is appropriate to that culture. So you must set the culture before the InitializeComponent method is called.

' Visual Basic
' Put the Imports statements at the beginning of the code module
Imports System.Threading
Imports System.Globalization
' Put the following code before InitializeComponent()
' Sets the culture to French (France)
Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR")
' Sets the UI culture to French (France)
Thread.CurrentThread.CurrentUICulture = new CultureInfo("fr-FR")
 
Back
Top