Formating a text box

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

Guest

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?
 
Bill said:
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
 
Back
Top