I need to make the application work according to system culture. But i have used many hardcoded value for Bit and byte conversion Like Dim maxlimit as double=4.999999
.
When i change the cultureInfo for application the bit convertion is not proper. So I am looking for a solution How to use hard coded double values according to the system culture and to manipulate them? (like multiplication, division, addition).
I have used the below snippet to convert the value to Double according to system culture. i have set the Culture to "de-DE"
Code:
Dim l_sDoubleValue As Double
If String.Equals(CultureInfo.CurrentUICulture.ToString(), "de-DE",StringComparison.OrdinalIgnoreCase) Then
l_sDoubleValue = Convert.ToDouble(p_sValue.ToString(CultureInfo.CurrentUICulture), CultureInfo.CurrentUICulture.NumberFormat)
ElseIf String.Equals(CultureInfo.CurrentUICulture.ToString(), "en-US", StringComparison.OrdinalIgnoreCase) Then
l_sDoubleValue = Double.Parse(p_sValue)
End If
Return l_sDoubleValue
Example:
Value = 4.999999
When i convert the value to string using p_sValue.ToString(CultureInfo.CurrentUICulture)
the output is 4,999999 but when i convert the value to Double the output is 4.999999