Formating money for display in a textbox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a textbox that displays money, I cannot find out how to format it so
it displayes like '$123.00' what i get now is '123.00'. Can someone point me
in the right direction?

Thanks in advance!!!
 
Chris thanks for you help on this problem. I have been working on something
else and now I am back to this problem. The number add up ok but do not
format, what am I missing!! please help.

xnum = double.Parse(lcost); ***** this is passed in *******
ynum = double.Parse(txtServiceCost.Text); ***** this is in the textbox *****
znum = xnum + ynum;
znum.ToString("C");
 
What are you assigning your formatted currency to?

With your code:

xnum = double.Parse(lcost); ***** this is passed in *******
ynum = double.Parse(txtServiceCost.Text); ***** this is in the textbox
*****
znum = xnum + ynum;
txtResult.Text = znum.ToString("C");


ToString() is a method and it returns a string value in the format of a
currency. You have to put that string somewhere though!

Steven Nagy
 
Steve, I am new to this kind of code, and stuck on stupid. Can you please
give me and example!! Thanks.
 
Um, I did in my previous posting... ?

If 'znum' is a double, and 'txtResult' is the text box where you want
to put your formatted result, then you need this line:

txtResult.Text = znum.ToString("C");

Is this what you ment?

Steven Nagy
 
Back
Top