Decimal point from the control panel Setting options
I am creating an application with VB.NET
As stated on MSDN, I changed the Culture to en-US. It works to override the decimal point to point if the user sets the regional format to any comma-separated language.
Public Sub New()
Thread.CurrentThread.CurrentCulture = New CultureInfo("en-US")
Thread.CurrentThread.CurrentUICulture = New CultureInfo("en-US")
InitializeComponent()
End Sub
Now the problem is , how can I override the decimal separator if the user has changed the system decimal separator from Control Panel> Region and Language> Advanced Settings (under Format tab)?
CultureInfo cannot override these custom settings. I need to override the entire decimal point separator without using the string replace function.
+3
source to share
1 answer
Set the NumberFormat
property CultureInfo
:
Dim myCI As New CultureInfo("en-US", False)
myCI.NumberFormat.CurrencyDecimalSeparator = "."
Thread.CurrentThread.CurrentCulture
= Thread.CurrentThread.CurrentUICulture
= myCI
+2
source to share