Learn how to a build a cloud-first strategyRegister Now


round .5 to nearest integer asp.net 3.5 vb 2008

Posted on 2012-09-21
Medium Priority
Last Modified: 2012-09-22
These statements both return 8

Math.Round(7.5, 0)
Math.Round(8.5, 0)

I would like the first to return 8 and the second to return 9.
How do I achieve this?
Question by:AlHal2
LVL 83

Accepted Solution

CodeCruiser earned 820 total points
ID: 38422230
Pass a third parameter

Math.Round(7.5, 0, MidPointRounding.AwayFromZero)


Author Closing Comment

ID: 38425299

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

810 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