Solved

How to Round Numbers???

Posted on 2004-10-18
3
222 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

617 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