How to change currency symbol

  • Thread starter Thread starter Sakharam Phapale
  • Start date Start date
S

Sakharam Phapale

Hi All,

I want to change currency symbol of current culture.
I am trying to do this by following code.


Dim obj As CultureInfo = System.Globalization.CultureInfo.CurrentCulture()
obj.NumberFormat.CurrencySymbol = "Rs"

Session.LCID = obj.LCID


But, still all currency controls on page shows "$"
So how to achieve this?
Since, we can read and write "CurrencySymbol" property then why it's not
working?
Any suggestion please?

Thanks in advance.

Sakharam Phapale
 
Sakharam said:
Hi All,

I want to change currency symbol of current culture.
I am trying to do this by following code.


Dim obj As CultureInfo =
System.Globalization.CultureInfo.CurrentCulture()
obj.NumberFormat.CurrencySymbol = "Rs"

Session.LCID = obj.LCID


But, still all currency controls on page shows "$"
So how to achieve this?
Since, we can read and write "CurrencySymbol" property then why it's
not working?
Any suggestion please?

Thanks in advance.

Sakharam Phapale

Hi Sakharam,

It does in fact work, just not the way that you are expecting, you can
alter the currency symbol, but it is only altered for that instance of
the CultureInfo object. i.e. if you were to do something like
value.ToString("C",obj.NumberFormat) you would get the expected result
however this is not much good to you when you are passing to another
control or routine that is doing the formatting.

If you need to persist the change to the system so that each time you
get a CurrentCulture its the changed value, you will need to PInvoke to
the SetLocaleInfo API call with the LOCAL_SCURRENCY flag set.

Regards Tim.
 
Back
Top