Formating a number to specific decimal places.

Apr 3 2008 12:33 PM

I have a variable "totalWeightInGrams" that is of type double.  The code looks similar to this:

Result.Text = Convert.ToString(totalWeightInGrams);

"totalWeightInGrams" is holding a value of 19.284759 and "Result" is a textbox. 

I have been looking over the internet and all the examples show how to round the results in a Console Window.  I have tried using some of the formating code in a lot of different ways, but my syntax is still wrong. Can someone help point me in the right direction with out giving me the answer.  I am new to programming and want to figure it out without it being given to me. I don't have all the code right now, but if more is needed I will post it later today.

Thanks Aaron


Answers (1)