Solved

How to Round Numbers???

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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…
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.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

708 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

15 Experts available now in Live!

Get 1:1 Help Now