Format Numbers to Currency String in VB.NET
I thought it would be helpful to share this piece of simple code
In VB.NET, it is pretty easy to convert a decimal number (say, 12345.6789) to currency format ($12,345.679)
Just convert the number using the lines of code as shown below:
Dim value_int As Integer = 12345.6789 ' original decimal number
Dim digit As Integer = 3 ' to format it to 3 decimal places
Dim value_str As String = value_int.ToString("C" & digit, Globalization.CultureInfo.CreateSpecificCulture("en-US"))
Also check out other cultures available here.
1 Comment + Add Comment
Got anything to say? Go ahead and leave a comment!
Archives
- July 2011
- June 2011
- May 2011
- February 2011
- January 2011
- December 2010
- November 2010
- October 2010
- September 2010
- August 2010
- July 2010
- June 2010
- March 2010
- February 2010
- January 2010
- December 2009
- September 2009
- July 2009
- June 2009
- May 2009
- April 2009
- March 2009
- February 2009
- January 2009
- December 2008
- November 2008
- October 2008
- September 2008
- August 2008



Posted under:
Extremely helpful, despite being posted in the wrong section, haha. Thanks for this great bit of code.