Convert double to string

后端 未结 2 914
既然无缘
既然无缘 2020-12-11 14:46

i have three double variable a ,b and c

a = 0.000006 
b = 6 
c = a/b;

so C should be 0.000001

i want to show this value in text bo

相关标签:
2条回答
  • 2020-12-11 15:00
    a = 0.000006;
    b = 6;
    c = a/b;
    
    textbox.Text = c.ToString("0.000000");
    

    As you requested:

    textbox.Text = c.ToString("0.######");
    

    This will only display out to the 6th decimal place if there are 6 decimals to display.

    0 讨论(0)
  • 2020-12-11 15:07

    Try c.ToString("F6");

    (For a full explanation of numeric formatting, see MSDN)

    0 讨论(0)
提交回复
热议问题