Force 3 decimals

Posted on 2006-06-08
Last Modified: 2010-04-16
Hi, I am wondering, is there a way to force a number to come back with at least 3 decimal places.

if I use:

string returnValue      = "";
double numDbl            = 0;
string numText            = "";
if( numericFieldText != null && !numericFieldText.Equals("") )
      numDbl      = System.Convert.ToDouble(numericFieldText);
      numDbl      = System.Math.Round(numDbl,3);
      numText = numDbl.ToString();                                          

returns just a number like 7.76, for example.

I would like it to return 7.760

Question by:cdfllc
    LVL 5

    Accepted Solution

    LVL 5

    Expert Comment


    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
    Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    755 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

    24 Experts available now in Live!

    Get 1:1 Help Now