Windows Develop Bookmark and Share   
 index > Windows Forms Designer > How to format money with $, commas and 2 decimal in textbox?
 

How to format money with $, commas and 2 decimal in textbox?

Any one know?

Please help!
MigrationUser 1  Wednesday, June 11, 2003 6:57 PM
One admittedly ineligant way to do this is to convert the text to a double/decimal/single and then do this:

someVariable.ToString("c");

where someVariable is a double/decimal/single.

I would use the parse command to get the double of it like this:

someVariable = double.Parse(txt, NumberFormatStyles.Any);

Just to make sure everything is included. Note that percents are not accepted by the parse command even if you choose Any for number format styles.  This is a bug in the framework if you ask me....
MigrationUser 1  Tuesday, June 17, 2003 12:22 PM

MyTextBox.Text = Microsoft.VisualBasic.FormatCurrency(MyDecimal, 2)


 ;) 
MigrationUser 1  Wednesday, June 18, 2003 5:42 AM

You can use google to search for other answers

Custom Search

More Threads

• windows forms 2.0> when close button on title bar is clicked
• Dock Padding
• Collapsible Listview control
• How to Hide Entire Category in a PropertyGrid
• sorting Datagridview
• User Control Wierd Bug?
• Can't cut or delete controls
• How to specify in NETCF custom DesignerSerializer for Form ?
• Custom Collection Editor + Drop Down
• IDE Designer unable to display forms containing user controls