Home All Groups Group Topic Archive Search About

Formatting numeric values in a textbox

Author
10 Nov 2006 11:47 AM
AlBruAn
How do I go about formatting a numeric value for display in a textbox?  I
have two textboxes in which I take the values entered into them and convert
them into decimal values via the System.Convert.ToDecimal() function.  I need
to take the results of that calculation and display it in a third textbox
with a format of "10.00" if the two values are, for instance, "2.0" and
"5.00".  What happens is that it gets displayed as "10.000".  :(

Author
10 Nov 2006 11:52 AM
Ciaran O''Donnell
textbox3.Text = mydecimalanswer.ToString("f2");

Ciaran O'Donnell

Show quote
"AlBruAn" wrote:

> How do I go about formatting a numeric value for display in a textbox?  I
> have two textboxes in which I take the values entered into them and convert
> them into decimal values via the System.Convert.ToDecimal() function.  I need
> to take the results of that calculation and display it in a third textbox
> with a format of "10.00" if the two values are, for instance, "2.0" and
> "5.00".  What happens is that it gets displayed as "10.000".  :(

AddThis Social Bookmark Button