Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Weird behavior on localization
Message
From
30/07/2010 04:12:22
 
 
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:
01474574
Views:
35
>Are you setting the culture on the server or using Browser settings ?
>It sounds as if this is more likely to be a browser issue......

The DLL is using the Format() method built in the .NET Framework 4.0. So, when comes time to format a value such as $12.95, I am using the Format() method. Basically, it goes like this. I am calling the GetFormatValueDollar(), which calls GetFormat() to obtain the desired format so to pass it to the base method after. For some kind of reason, once I compile, it could be a dot or a comma. Sometimes, I will see a dot 4 times in a row. Then, on the next compile, I see a comma, such as $12,95.
        ' Format a value
        ' expC1 Separator
        ' expN2 Number of decimals
        Public Function GetFormat(ByVal tcSeparator As String, ByVal tnDecimal As Integer) As String
            Dim lcFormat As String = ""
            Dim lnCounter As Integer = 0

            ' Obtain formatted value
            For lnCounter = 1 To 9
                lcFormat = "#" + lcFormat

                If lnCounter Mod 3 = 0 Then
                    lcFormat = tcSeparator + lcFormat
                End If

            Next

            lcFormat = lcFormat + "0"

            ' If we have decimals
            If tnDecimal > 0 Then
                lcFormat = lcFormat + "." + "".PadRight(tnDecimal, "0")
            End If

            Return lcFormat
        End Function

        ' Format a value for a dollar
        ' expN1 Value
        ' expC1 Separator
        Public Function GetFormatValueDollar(ByVal tnValue As Double, ByVal tcSeparator As String) As String
            Dim lcFormat As String = ""
            Dim lcValue As String = ""
            Dim llDollarSignToTheRight As Boolean = True

            lcFormat = GetFormat(tcSeparator, 2)
            lcValue = Format(tnValue, lcFormat) + "$"

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

                ' Based on the language
                Select Case nLanguage

                    ' English
                    Case 1
                        lcValue = "$" + Format(tnValue, lcFormat)

                        ' French
                    Case 2
                        lcValue = Format(tnValue, lcFormat) + "$"

                        ' Spanish
                    Case 3
                        lcValue = Format(tnValue, lcFormat) + "$"

                        ' Portuguese
                    Case 4
                        lcValue = Format(tnValue, lcFormat) + "$"

                End Select

            End If

            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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform