• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 226
  • Last Modified:

Number format


I am using following code

decimal i = 191419

  string j = string.Format("{0:N}", i);

then the out put is  1,91,419.00 (which is correct) in en-In culture...

But When i am using the same code in client machine which is under en-GB

I am getting following output


but i want the out put on client machine like this  1,91,419.00

please suggest
1 Solution
Mike TomlinsonMiddle School Assistant TeacherCommented:
en-GB will not display as "1,91,419.00" because that is incorrect for GB.  Commas are placed in groups of three because that is how the number is said in GB.  If the clients machine is set to en-GB, then they will expect commas in groups of three!

If you want to force the output to use en-IN regardless of the local culture setting, you'll have to explicitly create that CultureInfo in code and use that.

I've used C# as that is what your example was in despite being tagged as VB.Net:
            decimal i = 191419;
            System.Globalization.CultureInfo India = new System.Globalization.CultureInfo("en-IN");
            string j = string.Format(India, "{0:N}", i);
            label1.Text = j;

Open in new window

praveen1981Author Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now