Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Mix up in CultureInfo
Message
De
10/09/2015 08:11:27
 
 
À
10/09/2015 02:44:26
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
VB 9.0
OS:
Windows 8.1
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01624382
Message ID:
01624436
Vues:
37
>What properties of CultureInfo (other than NumberFormatInfo) affect the returned value ?

I think it was related when I standardized two methods. Here is one for the currency display:
    ' Format a value for a dollar
    ' expN1 Value
    ' expC1 Separator
    Public Function GetFormatValueDollar(ByVal tnValue As Double, ByVal tcSeparator As String) As String
        Dim lcValue As String = ""
        Dim loCultureInfo As CultureInfo = Nothing

        ' Based on the language
        Select Case nLanguage

            ' English
            Case 1
                loCultureInfo = oApp.oCultureInfoEnglish

                ' French
            Case 2
                loCultureInfo = oApp.oCultureInfoFrench

                ' Spanish
            Case 3
                loCultureInfo = oApp.oCultureInfoSpanish

                ' Portuguese
            Case 4
                loCultureInfo = oApp.oCultureInfoPortuguese

        End Select

        loCultureInfo.NumberFormat.CurrencyDecimalSeparator = "."
        loCultureInfo.NumberFormat.CurrencyGroupSeparator = tcSeparator

        ' If we format the dollar sign as per the language
        If oApp.lFormatDollarAsPerTheLanguage Then

            ' Based on the language
            Select Case nLanguage

                ' English
                Case 1

                    ' French
                Case 2
                    loCultureInfo.NumberFormat.CurrencyPositivePattern = 1

                    ' Spanish
                Case 3

                    ' Portuguese
                Case 4

            End Select

        End If

        lcValue = tnValue.ToString("C", loCultureInfo)

        Return lcValue
    End Function
In there, I am using the culture info for the display of the dollar sign. So, for the other method, I simply followed the same approach. I believe this suggestion came from here BTW.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform