Click here to Skip to main content
15,905,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have some amount value in the text box..usually the text ox value will show like this-2073635.00..i have to show the value in the Indian rupees format like this-20,73,635.00..I want the syntax for this..please help me....
Posted
Updated 5-Jun-12 1:01am
v2

 
Share this answer
 
C#
double aNumber = 2073635.00;
System.Globalization.CultureInfo info = System.Globalization.CultureInfo.GetCultureInfo("hi-IN");
string str = aNumber.ToString("C2",info);

And now str is: "(Rupee sign) 20,73,635.00"
Why does this look so complicated?
[Edit:]The rupee sign gets destryoed during copy/paste in Firefox[/Edit]
 
Share this answer
 
v2
Comments
VJ Reddy 5-Jun-12 8:38am    
Good answer. 5!
double aNumber = 2073635.00;
System.Globalization.CultureInfo info = System.Globalization.CultureInfo.GetCultureInfo("hi-IN");
string str = aNumber.ToString("C2",info);

And now str is: "(Rupee sign) 20,73,635.00"




double aNumber = 2073635.00;
System.Globalization.CultureInfo info = System.Globalization.CultureInfo.GetCultureInfo("hi-IN");
string str = aNumber.ToString("N2",info);


And now str is: "20,73,635.00"
 
Share this answer
 
v2
Comments
[no name] 15-Jul-15 3:53am    
Posting a copied (accepted) answer will not end well.
CHill60 15-Jul-15 7:10am    
Does pasting it twice make it twice as bad? ;-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900