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 214 views
214 views asked Apr 17, 2019 by avibootz
1 answer 163 views
1 answer 199 views
1 answer 142 views
1 answer 157 views
1 answer 169 views
4 answers 236 views
236 views asked Apr 6, 2022 by avibootz
...