Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Weird behavior on localization
Message
From
30/07/2010 11:41:05
 
 
To
30/07/2010 11:25:20
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01474524
Message ID:
01474608
Views:
38
This message has been marked as a message which has helped to the initial question of the thread.
>>I guess that boils down to this line:
lcValue = Format(tnValue, lcFormat) + "$"
which is using the legacy Microsoft.VisualBasic.Strings stuff. I don't really remember how that worked but I think it translates based on the Windows locale rather then the .NET current culture. Why not just use the .NET .ToString() methods e.g.:
Public Function GetFormatValueDollar(ByVal tnValue As Double, ByVal nLanguage As Integer) As String
>>        Dim info As CultureInfo
>>        Select Case nLanguage
>>            Case 1
>>                info = New CultureInfo("en-US")
>>            Case Else
>>                info = New CultureInfo("fr-CA")
>>                ' If you want different separators:
>>                info.NumberFormat.CurrencyDecimalSeparator = "."
>>                info.NumberFormat.CurrencyGroupSeparator = ","
>>
>>        End Select
>>        Return tnValue.ToString("c", info)
>>    End Function
>
>Thank you, I will use that.

Thinking about it, since all you are doing is switching the currency sign to a trailing position for the French version this would be even simpler:
   Public Function GetFormatValueDollar(ByVal tnValue As Double, ByVal nLanguage As Integer) As String
        Dim info As New CultureInfo("en-US")
        Select Case nLanguage
            Case 1
             Case Else
                info.NumberFormat.CurrencyPositivePattern = 1
        End Select
        Return tnValue.ToString("c", info)
    End Function
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform