By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,775 Members | 1,399 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,775 IT Pros & Developers. It's quick & easy.

convert double to currency

P: n/a
Hi all,
I was wondering if there was a way to convert a double value to currency.
sometimes the double number is: 7 or 7.7 or 7.77 or 7.776543
I needed to always get a decimal and 2 digits after the decimal for every
answer.
thanks
--
Ad****@hotmail.com
Nov 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
You will need to pass a string format to the two string method of the double
object.

IE.

Dim d as Double

d = 7
Console.WriteLine( d.ToString( "##0.00" ) )
d = 7.7
Console.WriteLine( d.ToString( "##0.00" ) )
d = 7.776543
Console.WriteLine( d.ToString( "##0.00" ) )

http://msdn.microsoft.com/library/de...matstrings.asp

HTH,

bill

"ACaunter" <Ad****@hotmail.com> wrote in message
news:01**********************************@microsof t.com...
Hi all,
I was wondering if there was a way to convert a double value to currency.
sometimes the double number is: 7 or 7.7 or 7.77 or 7.776543
I needed to always get a decimal and 2 digits after the decimal for every
answer.
thanks
--
Ad****@hotmail.com

Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.