How to convert decimal to string in currency format with VB.NET

1 Answer

0 votes
Imports System
Imports System.Globalization
                 
Public Module Module1
    Public Sub Main()
        Dim d As Decimal = 8493747.98D

        Dim specifier As String
        Dim culture As CultureInfo
 
        specifier = "C"
        
        culture = CultureInfo.CreateSpecificCulture("en-US")
        Console.WriteLine(d.ToString(specifier, culture))
        
        culture = CultureInfo.CreateSpecificCulture("en-GB")
        Console.WriteLine(d.ToString(specifier, culture))
    End Sub
End Module
 
 
 
 
' run:
'
' $8,493,747.98
' £8,493,747.98
'

 



answered Feb 2, 2021 by avibootz

Related questions

1 answer 208 views
208 views asked Apr 17, 2019 by avibootz
1 answer 159 views
1 answer 189 views
1 answer 137 views
1 answer 181 views
181 views asked Nov 18, 2021 by avibootz
1 answer 151 views
1 answer 164 views
...