views:

369

answers:

4

Hello,

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 box so i wrote

textbox.text = c.tostring();

but it's give result as "1E-06"..

Can anybody help me out how can i put correct value in textbox ?

Thanks

+4  A: 

Have you tried using string formatting?

Ed Swangren
A: 

Does this help?

Juan Manuel
if i use .tostring("##.#######") it 's give .000001 instead of 0.000001
Kartik
+5  A: 
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.

Adam Davis
I don't want to give all time decimal mean if a= 6 / b= 2 then c should be 3 not 3.000000
Kartik
THANK YOU VERY MUCH
Kartik
Glad to be of service. Good luck with your project!
Adam Davis
+1  A: 

Try c.ToString("F6");

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

Jim Arnold