468,491 Members | 1,918 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,491 developers. It's quick & easy.

format string for currency

i thought the following would work for currency

{0:$000,000,000.00}

but it is displaying ( for example ) :

$000,025,368.87

i don't want the extra zeros ...
Nov 20 '05 #1
6 8224
try this
{0:$###,##0.00}

but I think there must exist a shortcut ;-)

"John A Grandy" <johnagrandy-at-yahoo-dot-com> wrote in message
news:uc**************@TK2MSFTNGP12.phx.gbl...
i thought the following would work for currency

{0:$000,000,000.00}

but it is displaying ( for example ) :

$000,025,368.87

i don't want the extra zeros ...

Nov 20 '05 #2
Hi,

Dim c As Decimal = 12.68

Me.Text = c.ToString("c")

http://msdn.microsoft.com/library/de...matStrings.asp

Ken

-------------------------

"John A Grandy" <johnagrandy-at-yahoo-dot-com> wrote in message
news:uc**************@TK2MSFTNGP12.phx.gbl...
i thought the following would work for currency

{0:$000,000,000.00}

but it is displaying ( for example ) :

$000,025,368.87

i don't want the extra zeros ...

Nov 20 '05 #3
if i use "c" , the formatting then follows the
System.Globalization.CultureInfo.NumberFormat in effect for the page ,
correct ?

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:ur**************@tk2msftngp13.phx.gbl...
Hi,

Dim c As Decimal = 12.68

Me.Text = c.ToString("c")

http://msdn.microsoft.com/library/de...matStrings.asp
Ken

-------------------------

"John A Grandy" <johnagrandy-at-yahoo-dot-com> wrote in message
news:uc**************@TK2MSFTNGP12.phx.gbl...
i thought the following would work for currency

{0:$000,000,000.00}

but it is displaying ( for example ) :

$000,025,368.87

i don't want the extra zeros ...


Nov 20 '05 #4
Hi,

yes

Ken
-----------------
"John A Grandy" <johnagrandy-at-yahoo-dot-com> wrote in message
news:ej**************@TK2MSFTNGP10.phx.gbl...
if i use "c" , the formatting then follows the
System.Globalization.CultureInfo.NumberFormat in effect for the page ,
correct ?

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:ur**************@tk2msftngp13.phx.gbl...
Hi,

Dim c As Decimal = 12.68

Me.Text = c.ToString("c")

http://msdn.microsoft.com/library/de...matStrings.asp

Ken

-------------------------

"John A Grandy" <johnagrandy-at-yahoo-dot-com> wrote in message
news:uc**************@TK2MSFTNGP12.phx.gbl...
>i thought the following would work for currency
>
> {0:$000,000,000.00}
>
> but it is displaying ( for example ) :
>
> $000,025,368.87
>
> i don't want the extra zeros ...
>
>



Nov 20 '05 #5
Ok ...

But what if I want a shorthand format-specifier that does not rely on any
more-global objects (such as CultureInfo). Must such specifiers always be
designated character-by-character ?

For example, if I want to display currency with a dollar-sign prefix, each
group of 3 digits separated by a comma, no decimal point or decimal places,
and blank for negative or zero values, then I would have to use something
like

"$###,###,###;;"

But how to cover the case where the currency value might be larger? (more
than 9 digits might need to be present)


"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:ON*************@TK2MSFTNGP12.phx.gbl...
Hi,

yes

Ken
-----------------
"John A Grandy" <johnagrandy-at-yahoo-dot-com> wrote in message
news:ej**************@TK2MSFTNGP10.phx.gbl...
if i use "c" , the formatting then follows the
System.Globalization.CultureInfo.NumberFormat in effect for the page ,
correct ?

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:ur**************@tk2msftngp13.phx.gbl...
Hi,

Dim c As Decimal = 12.68

Me.Text = c.ToString("c")

http://msdn.microsoft.com/library/de...matStrings.asp

Ken

-------------------------

"John A Grandy" <johnagrandy-at-yahoo-dot-com> wrote in message
news:uc**************@TK2MSFTNGP12.phx.gbl...
>i thought the following would work for currency
>
> {0:$000,000,000.00}
>
> but it is displaying ( for example ) :
>
> $000,025,368.87
>
> i don't want the extra zeros ...
>
>



Nov 20 '05 #6
again...
I have no MVP in my name so it is not good enough???

format {0:$###,##0.00} for 123456789 shows "123,456,789.00"
"John A Grandy" <johnagrandy-at-yahoo-dot-com> wrote in message
news:O%****************@TK2MSFTNGP11.phx.gbl...
Ok ...

But what if I want a shorthand format-specifier that does not rely on any
more-global objects (such as CultureInfo). Must such specifiers always be
designated character-by-character ?

For example, if I want to display currency with a dollar-sign prefix, each
group of 3 digits separated by a comma, no decimal point or decimal places, and blank for negative or zero values, then I would have to use something
like

"$###,###,###;;"

But how to cover the case where the currency value might be larger? (more
than 9 digits might need to be present)


"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:ON*************@TK2MSFTNGP12.phx.gbl...
Hi,

yes

Ken
-----------------
"John A Grandy" <johnagrandy-at-yahoo-dot-com> wrote in message
news:ej**************@TK2MSFTNGP10.phx.gbl...
if i use "c" , the formatting then follows the
System.Globalization.CultureInfo.NumberFormat in effect for the page ,
correct ?

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:ur**************@tk2msftngp13.phx.gbl...
> Hi,
>
> Dim c As Decimal = 12.68
>
> Me.Text = c.ToString("c")
>
>
>
>

http://msdn.microsoft.com/library/de...matStrings.asp
>
>
>
> Ken
>
> -------------------------
>
> "John A Grandy" <johnagrandy-at-yahoo-dot-com> wrote in message
> news:uc**************@TK2MSFTNGP12.phx.gbl...
> >i thought the following would work for currency
> >
> > {0:$000,000,000.00}
> >
> > but it is displaying ( for example ) :
> >
> > $000,025,368.87
> >
> > i don't want the extra zeros ...
> >
> >
>
>



Nov 20 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Dalan | last post: by
2 posts views Thread by DD | last post: by
4 posts views Thread by Gerry Abbott | last post: by
2 posts views Thread by AMDRIT | last post: by
2 posts views Thread by crferguson | last post: by
7 posts views Thread by Nariban Barkan | last post: by
reply views Thread by NPC403 | last post: by
3 posts views Thread by gieforce | last post: by
reply views Thread by theflame83 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.