Solved

How to Round Numbers???

Posted on 2004-10-18
3
217 Views
Last Modified: 2010-04-15
I am currently building a Web Page in Visual Studio.NET.... (C#).  I am trying to figure out how to 'round numbers" that I am pulling into text boxes in my Web Form from a DB.  Currently, When I view the page the numbers are coming up as "0.96544456754363."  I want to round them to  "0.97". How would I do this in C#?
Thanks
0
Comment
Question by:bripena
  • 2
3 Comments
 
LVL 6

Accepted Solution

by:
der_jth earned 50 total points
ID: 12339799
Depending on how you're handling the data, something like txtMyTextBox.Text = myDouble.ToString("#.##") could be useful.
0
 

Author Comment

by:bripena
ID: 12339936
Hold on- I tried and now I get this error below....

c:\inetpub\wwwroot\CREAMPROFILE1\CREAMFORM.aspx.cs(110): The type or namespace name 'CREAMPROFILE1' could not be found (are you missing a using directive or an assembly reference?)
0
 
LVL 6

Expert Comment

by:der_jth
ID: 12340400
That error is not related to the double rounding statement but rather another code change you've done. It's hard to say what's causing the error, but perhaps it's some sort of namespace renaming operation you've been doing.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

685 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