Solved

How to Round Numbers???

Posted on 2004-10-18
3
220 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ComboBox to String Not Working 5 43
Adjust the codes 3 65
asp.net repeater server posting 5 39
How to get the range for the percentage from user input. 4 27
Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

752 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