currency formatting question

joelk

Member
Joined
Jul 15, 2009
Messages
6
Programming Experience
Beginner
Can anyone help me format this so a $ sign shows up?

Dim thePaidAmount As String = item.AmountPaid
thePaidAmount = String.Format("{0:#######0.00}", thePaidAmount)
 
thanks robert,
I tried your code and got an error message saying

"Input string was not in a correct format"

what could be the deal bros?
 
Assuming item.AmountPaid is a numerical value it should be just:
VB.NET:
thePaidAmount = item.AmountPaid.ToString("c")
That will use the current regional settings to find the default currency format, which will be a leading $ symbol and 2 decimal places by deafult in the US, Australia and various other places that use dollars. If you want to ensure US currency format even if the regional settings are different then you should create your own CultureInfo for the en-US culture and use its NumberFormat property.
 
Back
Top