Number format

Hi

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

191,419.00

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

please suggest
praveen1981Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
praveen1981Author Commented:
Thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.