> ' 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 >>
Public Structure Cultures Public Const English As String = "en-US" Public Const French As String = "fr-CA" Public Const Spanish As String = "en-US" Public Const Portuguese As String = "en-US" End Structureset nLanguage to Cultures.French (or whatever) then
Public Shared Function GetFormatValue(tnValue As Double, tcSeperator As String, tnDecimal As Integer) As String Dim nfi As NumberFormatInfo = New CultureInfo(nLanguage).NumberFormat nfi.NumberDecimalSeparator = "." nfi.NumberGroupSeparator = tcSeperator nfi.NumberDecimalDigits = tnDecimal Select Case nLanguage Case Cultures.French If True Then nfi.CurrencyPositivePattern = 1 Exit Select End If End Select Return tnValue.ToString("C", nfi) End Function