Format the number

  • Thread starter Thread starter Karthik
  • Start date Start date
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
 
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
 
Back
Top