Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Internationalization / January 2005

Tip: Looking for answers? Try searching our database.

Overriding the default currency symbol

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tim Jarvis - 03 Jan 2005 04:36 GMT
Hi,

I have an application that uses multiple currencies, I have been
displaying the currencies with the currency symbol as defined in the
RegionInfo class, but I have a situation where the "official" symbol is
not the one commonly used or recognised by the users, specifically it's
egyptian pounds, the symbol in the region info object is the arabic
sysmbol, however locally (In Egypt) it is referred to simply as LE i,e
for 100 egyptian pounds the users would expect to see LE 100 in the
receipts they produce.

For everything else the currency symbol works fine, I don't really want
to have to start storing and maintaing symbols, I would just like to be
able to everride this one (the egyptian one) I know I can do it from
the  control panel, but I would like to be able to set this
programatically

Any Ideas ?

Regards Tim.
Michael (michka) Kaplan [MS] - 03 Jan 2005 06:29 GMT
The property in RegionInfo is readonly, but the one in
CultureInfo.NumberFormat is not -- you can try that one to see if it helps?

Signature

MichKa [MS]
NLS Collation/Locale/Keyboard Technical Lead
Globalization Infrastructure, Fonts, and Tools
Microsoft Windows International Division

This posting is provided "AS IS" with
no warranties, and confers no rights.

> Hi,
>
[quoted text clipped - 16 lines]
>
> Regards Tim.
|||Cypher||| - 03 Jan 2005 20:23 GMT
Hi.

Here is a code snippet taken from my homemade 18n class.

public static string Currency(int price){

NumberFormatInfo nfi = CultureInfo.CurrentCulture.NumberFormat;
//ci.NumberFormat;

return price.ToString("c",nfi);

}

HTH.

Regards.

> The property in RegionInfo is readonly, but the one in
> CultureInfo.NumberFormat is not -- you can try that one to see if it helps?
[quoted text clipped - 19 lines]
> >
> > Regards Tim.
Michael (michka) Kaplan [MS] - 03 Jan 2005 22:07 GMT
I believe you will find that the one from CurrentCulture is the one thzt
will be used automatically when no culture is passed.

Signature

MichKa [MS]
NLS Collation/Locale/Keyboard Technical Lead
Globalization Infrastructure, Fonts, and Tools
Microsoft Windows International Division

This posting is provided "AS IS" with
no warranties, and confers no rights.

> Hi.
>
[quoted text clipped - 37 lines]
> > >
> > > Regards Tim.
Tim Jarvis - 03 Jan 2005 22:48 GMT
> The property in RegionInfo is readonly, but the one in
> CultureInfo.NumberFormat is not -- you can try that one to see if it
> helps?

Hi Michael,

Thanks for your reply, problem is with this approach is that I would
need to change the symbol each time I create a CultureInfo instance,
which of course means that I need to store my Symbol (or hard code it)
What I am after is a mechanism to change (and have the system store)
the default symbol, so that when I create the CultureInfo instance the
NumberFormat property already contains the right Symbol.

I know that you can change the symbol using the control panel (regional
Language options), so I am assuming you must be able to do it
programatically, perhaps there is a not a .NET way of doing it, maybe
via PInvoke...Any Idea's

Regards Tim.
Michael (michka) Kaplan [MS] - 04 Jan 2005 22:29 GMT
You can change it via the SetLocaleInfo method with the LOCALE_SCURRENCY
flag. This is the very API call that Regional Opions uses when you change
the symbol in its own UI.

Signature

MichKa [MS]
NLS Collation/Locale/Keyboard Technical Lead
Globalization Infrastructure, Fonts, and Tools
Microsoft Windows International Division

This posting is provided "AS IS" with
no warranties, and confers no rights.

> > The property in RegionInfo is readonly, but the one in
> > CultureInfo.NumberFormat is not -- you can try that one to see if it
[quoted text clipped - 15 lines]
>
> Regards Tim.
Tim Jarvis - 05 Jan 2005 02:20 GMT
> You can change it via the SetLocaleInfo method with the
> LOCALE_SCURRENCY flag. This is the very API call that Regional Opions
> uses when you change the symbol in its own UI.

Fabulous, thanks for that Michka, its much appreciated.

Regards Tim.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.