none
Return double value as it is in string format RRS feed

  • Question

  • Hello all

    I want to convert the value of double variable into string format as it is. Like suppose the value is 0.000002 and want to show it in the TextBox so I used the ToString() but it shows the result as 2e-06 and I want to show it as it is like 0.000002. I also tried the ToString("F") but it shows the same result.

    If anyone having solution on this problem please suggest.

    Regards,

    Rishi

    Wednesday, February 6, 2013 4:30 AM

Answers

  • You don't need to know the exact number of decimal points, just the maximum number. For example, if you know the number won't have more than 10 decimal places, use ten # characters. Then, if the number has less than that, only the decimal places that are actually needed will be displayed. You can even use a ridiculously large number, like

    ToString("##################.##########################################").
    • Marked as answer by RishiRajIT Wednesday, February 6, 2013 6:05 AM
    Wednesday, February 6, 2013 5:22 AM

All replies