Format the number

K

Karthik

Dear All,



I am using VS 2008.

I have a Textbox which allow only numeric chars alone.

While leave from the TextBox I want to format the number like the Format
style that the user defined

If Format Style is Indian System

Ex 123456789 value should be displayed like this 12,34,56,789

If Format Style is Western System

Ex 123456789 value should be displayed like this 123,456,789



I have test the following

Format(MyNumericValue.ToString, "##,##,##0.00")

It is not work fine. It give the value like this only 123,456,789



Can any one show me the right path?

Thanks in Advance.



Regards,

Karthik.C
 
H

Hans Kesting

Karthik wrote on 30-6-2009 :
Dear All,



I am using VS 2008.

I have a Textbox which allow only numeric chars alone.

While leave from the TextBox I want to format the number like the Format
style that the user defined

If Format Style is Indian System

Ex 123456789 value should be displayed like this 12,34,56,789

If Format Style is Western System

Ex 123456789 value should be displayed like this 123,456,789



I have test the following

Format(MyNumericValue.ToString, "##,##,##0.00")

It is not work fine. It give the value like this only 123,456,789



Can any one show me the right path?

Thanks in Advance.



Regards,

Karthik.C

You need to supply the correct culture:

int i=123456789;
CultureInfo c = new CultureInfo("hi-IN");
string s = i.ToString("#,##0", c);


Hans Kesting
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top