TextBox display decimal problem

  • Thread starter Thread starter Agnes
  • Start date Start date
A

Agnes

In my Datagrid, I will sum up the input value and store into decTtlFDebit
E.g DecTtlFDebit is 15
the textbox only display 15
I want the display is 15.00 , How can I do that ??

I try the following method , but still fail .
Me.txtTtlFDebit.Text = Math.Round(decTtlFDebit * 1.0, 2)
 
Agnes,
Me.txtTtlFDebit.Text = Math.Round(decTtlFDebit * 1.0, 2)
I would first set option stricht on in your program.

Math.Round surely does not return a string.

I hope this helps,

Cor
 
Agnes said:
In my Datagrid, I will sum up the input value and store into decTtlFDebit
E.g DecTtlFDebit is 15
the textbox only display 15
I want the display is 15.00 , How can I do that ??

Try this:

Me.txtTtlFDebit.Text = DecTtlFDebit.ToString("#0.00")

Be advised that if DecTtlFDebit holds a number with more than 2 decimal
places to the right, you will need to round it appropriately if that is what
you want. If you do not, the ToString will just truncate it at two decimal
places.

Hope this helps,
Brian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top