Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
String.Format
Message
De
18/02/2013 11:45:09
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01566272
Message ID:
01566274
Vues:
44
>Do you know how this VFP format
>
>
>transform(extension, '$,$$$,$$9.99')
>
>translates into StringBuilder AppendFormat ?

Not sure if this is related or if that could help, but to format dollar value in .NET, I use this:
        ' 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
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
Répondre
Fil
Voir

Click here to load this message in the networking platform