Friday 28 December 2012

Displaying Indian Currency Symbol in C#

The new Indian Currency Symbol () can be shown in a C# application by using the Unicode escape sequence (\u). The Unicode character value assigned to the new Indian currency symbol is 8377. It is equivalent to 20B9 in hexadecimal (base 16) notation.
 
So, we can display the new currency symbol in a C# application in the following manner:

label1.Text =  "\u20B9";

Please see the screenshot below that shows a Windows Forms C# application displaying the new currency symbol.


The labels in the above screenshot have been assigned text using the following commands:

label1.Text = "\u20B9 - " + label1.Font.Name;
label2.Text = "\u20B9 - " + label2.Font.Name;
label3.Text = "\u20B9 - " + label3.Font.Name; 


To display the currency symbol, the font used must support Unicode Standard 6.0 or later.  If your OS is Windows 7 or Vista and you are using a Microsoft font and it is not displaying the currency symbol, you may like to install the update that Microsoft released in early 2011 to update its fonts. To know more about this update, please visit this link.

Happy coding! 

No comments:

Post a Comment