Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista Tutorial - Format the number

Reply
 
Old 06-30-2009   #1 (permalink)
Karthik
Guest


 
 

Format the number

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







My System SpecsSystem Spec
Old 06-30-2009   #2 (permalink)
Hans Kesting
Guest


 
 

Re: Format the number

Karthik wrote on 30-6-2009 :
Quote:

> 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


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
-f format Format-Table Format-List against Select PowerShell
Windows Mail format bar doesn't format color, size, justification Browsers & Mail
How do I change the default endnote number format? Vista General
Converting date time format to string format PowerShell
Help! DVD format error: "Windows was unable to complete the format Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46