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
Alexey Smirnov - 08 Oct 2007 20:05 GMT
> 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"));
pvong - 08 Oct 2007 20:27 GMT
This is almost perfect. It cuts off my pennies. How do I get it to include
the 2 digits after the decimal?
>> 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
[quoted text clipped - 5 lines]
>
> try to format String.Format("{0:0,0}", dr.Item("Amount"));
Alexey Smirnov - 08 Oct 2007 20:29 GMT
> This is almost perfect. It cuts off my pennies. How do I get it to include
> the 2 digits after the decimal?
[quoted text clipped - 10 lines]
>
> - Show quoted text -
{0:0,0.00}
pvong - 08 Oct 2007 20:42 GMT
PERFECT!!!!
Thanks!
Phil
>> This is almost perfect. It cuts off my pennies. How do I get it to
>> include
[quoted text clipped - 14 lines]
>
> {0:0,0.00}
Mark Rae [MVP] - 08 Oct 2007 20:07 GMT
> 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")

Signature
Mark Rae
ASP.NET MVP
http://www.markrae.net
pvong - 08 Oct 2007 20:18 GMT
Mark,
I'm getting this error message.
Input string was not in a correct format.
I'm trying to do this in VB.Net
>> 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
[quoted text clipped - 3 lines]
>
> AmountL.Text = dr.Item("Amount").ToString("#,##0.00")
Mark Rae [MVP] - 08 Oct 2007 20:27 GMT
[top-posting corrected]
>>> 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
[quoted text clipped - 3 lines]
>>
>> AmountL.Text = dr.Item("Amount").ToString("#,##0.00")
> 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")

Signature
Mark Rae
ASP.NET MVP
http://www.markrae.net
pvong - 08 Oct 2007 20:46 GMT
Perfect! Thanks!
> [top-posting corrected]
>
[quoted text clipped - 11 lines]
>
> AmountL.Text = Convert.ToDecimal(dr.Item("Amount")).ToString("#,##0.00")