Reformating decimal numbers
-
Hi, I am working with a VS2005 windows application. There are some text boxes that are used for entering decimal numbers. If user enter -1234567.8, I want to reformat it as -1,234,567.80 How can I do it, I tried to use MaskText box but could :( Thanks you! Harsh
jayasshc
-
Hi, I am working with a VS2005 windows application. There are some text boxes that are used for entering decimal numbers. If user enter -1234567.8, I want to reformat it as -1,234,567.80 How can I do it, I tried to use MaskText box but could :( Thanks you! Harsh
jayasshc
You can use string.Format to format a number, or you can overload the textbox itself to give you the format you want, by handling events when the text changes, and reformating it. You're better off formating it when the focus leaves the textbox tho
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
You can use string.Format to format a number, or you can overload the textbox itself to give you the format you want, by handling events when the text changes, and reformating it. You're better off formating it when the focus leaves the textbox tho
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
Could you please give me an example? Thanks!
jayasshc
-
You can use string.Format to format a number, or you can overload the textbox itself to give you the format you want, by handling events when the text changes, and reformating it. You're better off formating it when the focus leaves the textbox tho
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
Hi, I got it, could find a good example. Thank you very much! Harsh
jayasshc