I Have a field that should consist a currency, which is according to my Region is Indonesia which is IDR or Rp.
and i build it with string.format
like this :
Dim price As Single = Single.Parse(Convert.ToSingle(lblAmountGV.Text))
lblAmount.Text = String.Format("{0,C}", price)
but it give me a dollar sign. and i Change the code :
lblAmount.Text = String.Format("Rp{0}", price)
but i didn't get the dot (.)
and Comma(,)
. so I change the code again by using FormatCurrency
:
lblAmount.Text = FormatCurrency(lblAmountGV.Text, , , TriState.True, TriState.True)
but it still give me a Dollar sign, later i found how to change the CultureInfo
:
by imports :
Imports System.Globalization
and on my code :
Dim culture = CultureInfo.GetCultureInfo(" id-ID")
Dim format = DirectCast(culture.NumberFormat.Clone(), NumberFormatInfo)
format.CurrencySymbol = "Rp."
var number = Decimal.Parse(lblAmountGV.Text, NumberStyles.Currency, format);
lblAmount.Text = number
but it still give me an $
sign, how to change the $
programatically?