Solved

Rouding a Double Value

Posted on 2006-07-17
2
202 Views
Last Modified: 2010-04-23
I am having difficulty rounding a number and displaying it the way I wnat it


right now I have

dim pricem as double

I do some calculations using it


then I go

pricem = math.round(pricem, 2)

this will work fine and round the number to two decimal places, but if the number is 111.3 it won't display the extra zero on the end

I then tried going

pricem = formatcurrency(pricem, 2) thinking this would convert it to the currency format (which is what I am trying to represent) but it does not display the extra zero as well....


i'm confused...
0
Comment
Question by:foobarr
2 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 500 total points
ID: 17121722
Hi foobarr,

pricem = Math.Round(Pricem,2)
Msgbox Pricem.ToString("#.00")

Tim Cottee
0
 
LVL 7

Author Comment

by:foobarr
ID: 17121727
yah i just got that going right before you answered heh

but I'm gonna use .toString("0.00") instead


thx for the prompt response
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now