Re: Formatting Numbers in VB
Dim Dec As Decimal = 1010.00
MsgBox(Dec.ToString("$###,###.#0"))
Re: Formatting Numbers in VB
Does the format have to be in quotes?
Re: Formatting Numbers in VB
Ok new problem. When I read in the text from a textbox and do Decimal.Parse(TheTextbox.text), it take what ever number is there (ex: 2.00) and converts it to 2D. I need it to stay at 2.00 or 5.14 or whatever the user enters. How do I get around this problem?
Re: Formatting Numbers in VB
More info, this is the code I am trying to get to work.
TheNumber = Decimal.Parse(TempString)
TheNumber = Decimal.Round(TheNumber, 2)
TheTextBox.Text = TheNumber.ToString("$###,###.##")
This works great except when the user enters 0.00 or 2.00, 13.00, etc..anything that ends in .00 is causing and issue. If its 2.00 it just displays 2 and if its 0.00 it completely blows up. Any ideas would be appreciated.
Re: Formatting Numbers in VB
Change "$###,###.##" to "$###,###.#0"