Solution 1 :
Use the following format in String.Format({0:c} , amount)
{0:c} default
{0:c0} for no decimal
{0:c3}for 3 decimal places and so on.
add 1,2,3 any number after c for that many decimal places
Solution 2 :
Dim nfi As New System.Globalization.NumberFormatInfo
nfi.CurrencyDecimalDigits = 0
nfi.CurrencySymbol = "£"
Dim amount As String = "300.440000000000"
Me.Label_Amount.Text = String.Format(nfi, "{0:c}", amount)
To Use the current culture instead of creating new one use this.
Dim nfi = DirectCast(System.Globalization.NumberFormatInfo.CurrentInfo.Clone(), System.Globalization.NumberFormatInfo)
nfi.CurrencyDecimalDigits = 0
Dim amount As String = "300.440000000000"Me.Label_Amount.Text = String.Format(nfi, "{0:c}", amount)
Rather than produce the same old content you have taken this subject to a whole new level . Kudos for not following the standard writing crowd. Live Crypto currency
ReplyDelete