ToString not writing 0.000

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ORC

    ToString not writing 0.000

    Hi,

    Is it possible to format the ToString function so that it will write 0
    instead of e.g. 0.0000 if the value is actually 0?

    I use this in my code to format the string: Value.ToString( "0.0000"); where
    value is a double.

    Thanks
    Ole


  • ORC

    #2
    Re: ToString not writing 0.000

    OK - figured it out: I can just use this instead:
    Value.ToString( "0.####"); - great feature!

    Ole

    "ORC" <orc@sol.dk> wrote in message
    news:OcJDdN7yEH A.260@TK2MSFTNG P11.phx.gbl...[color=blue]
    > Hi,
    >
    > Is it possible to format the ToString function so that it will write 0
    > instead of e.g. 0.0000 if the value is actually 0?
    >
    > I use this in my code to format the string: Value.ToString( "0.0000");[/color]
    where[color=blue]
    > value is a double.
    >
    > Thanks
    > Ole
    >
    >[/color]


    Comment

    • Maqsood Ahmed

      #3
      Re: ToString not writing 0.000

      You can use value.ToString( "#,0.000");
      it formats your double value to three decimal places and also puts a
      comma after each thousand value.

      Maqsood Ahmed
      Kolachi Advanced Technologies


      *** Sent via Developersdex http://www.developersdex.com ***
      Don't just participate in USENET...get rewarded for it!

      Comment

      Working...