Text Format for Decimal

P

pvong

I'm grabbing "Amount" from a DB with Decimal format. The outpul of
AmountL.Text comes up as 9999999.99 and I want to format this so it is
displayed as 9,999,999.99. Can someone help me with this simple task?

AmountL.Text = dr.Item("Amount")

Thanks!

Phil
 
A

Alexey Smirnov

I'm grabbing "Amount" from a DB with Decimal format. The outpul of
AmountL.Text comes up as 9999999.99 and I want to format this so it is
displayed as 9,999,999.99. Can someone help me with this simple task?

AmountL.Text = dr.Item("Amount")

Hi Phil

try to format String.Format("{0:0,0}", dr.Item("Amount"));
 
M

Mark Rae [MVP]

I'm grabbing "Amount" from a DB with Decimal format. The outpul of
AmountL.Text comes up as 9999999.99 and I want to format this so it is
displayed as 9,999,999.99. Can someone help me with this simple task?

AmountL.Text = dr.Item("Amount")

AmountL.Text = dr.Item("Amount").ToString("#,##0.00")
 
P

pvong

Mark,
I'm getting this error message.
Input string was not in a correct format.
I'm trying to do this in VB.Net
 
P

pvong

This is almost perfect. It cuts off my pennies. How do I get it to include
the 2 digits after the decimal?
 
M

Mark Rae [MVP]

"pvong" <phillip*at*yahoo*dot*com> wrote in message

[top-posting corrected]
I'm getting this error message.
Input string was not in a correct format.
I'm trying to do this in VB.Net

AmountL.Text = Convert.ToDecimal(dr.Item("Amount")).ToString("#,##0.00")
 
P

pvong

Perfect! Thanks!


Mark Rae said:
"pvong" <phillip*at*yahoo*dot*com> wrote in message

[top-posting corrected]
I'm getting this error message.
Input string was not in a correct format.
I'm trying to do this in VB.Net

AmountL.Text = Convert.ToDecimal(dr.Item("Amount")).ToString("#,##0.00")
 

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

Top