Formating a text box  
Author Message
jallman





PostPosted: Mon Nov 07 08:08:13 CST 2005 Top

Dotnet >> Formating a text box I am being very dumb... I am coverting an invoice value to a decimal and
displaying the result on a VB.net 2003 form. However, I only want to display
the result to 2 decimal places and I am struggling to it - sorry for such an
easy question!

Can somebody advice me how to achieve this?

--
Thanks

Bill Partridge

DotNet34  
 
 
Richard





PostPosted: Mon Nov 07 08:08:13 CST 2005 Top

Dotnet >> Formating a text box Bill Partridge wrote:
> I am being very dumb... I am coverting an invoice value to a decimal
> and displaying the result on a VB.net 2003 form. However, I only
> want to display the result to 2 decimal places and I am struggling to
> it - sorry for such an easy question!
>
> Can somebody advice me how to achieve this?

output = String.Format("{0:f2}", decimalValue);

If you use {0:f} then the number of decimal places from NumberFormatInfo
is used, if you use {0:c} then it will be printed as a currency value
(including the currency symbol).

Richard
--
http://www.grimes.demon.co.uk/workshops/fusionWS.htm
http://www.grimes.demon.co.uk/workshops/securityWS.htm