Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > How to knock off decimal places..

Reply
Thread Tools

How to knock off decimal places..

 
 
Davey
Guest
Posts: n/a
 
      12-05-2005
I have some code that divides a number and then prints this number. It
performs a cost rollup basically and then adds a percentage. The code works
fine except that the number returned has many figures afert the decimal
point (as you would expect really)
How can I remove these ? I am not really concerned about rounding up or
down, just removing to give me a whole number....

Many Thanks
Davey


 
Reply With Quote
 
 
 
 
Evertjan.
Guest
Posts: n/a
 
      12-05-2005
Davey wrote on 05 dec 2005 in microsoft.public.inetserver.asp.general:

> I have some code that divides a number and then prints this number. It
> performs a cost rollup basically and then adds a percentage. The code
> works fine except that the number returned has many figures afert the
> decimal point (as you would expect really)
> How can I remove these ? I am not really concerned about rounding up
> or down, just removing to give me a whole number....


If you are programming in ASP-vbScript:

formatnumber()

This is very basic, please read up on vbscript internal functions.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

 
Reply With Quote
 
 
 
 
Davey
Guest
Posts: n/a
 
      12-05-2005
No problem. I have found it !!

"Davey" <(E-Mail Removed)> wrote in message
news:O9sPUmY%(E-Mail Removed)...
> I have some code that divides a number and then prints this number. It
> performs a cost rollup basically and then adds a percentage. The code

works
> fine except that the number returned has many figures afert the decimal
> point (as you would expect really)
> How can I remove these ? I am not really concerned about rounding up or
> down, just removing to give me a whole number....
>
> Many Thanks
> Davey
>
>



 
Reply With Quote
 
Davey
Guest
Posts: n/a
 
      12-06-2005
Hi Evertjan,

I have used the FormatNumber() as you suggest. However, I am also using the
FormatCurrency() to display a cost as currency. This works fine but I get
different currency symbols on different servers !
I have checked the Regional Settings in control on both servers and they are
both set the same, but one displays $, and the other displays ....
Any ideas why this should be ??

Cheers
Davey


"Evertjan." <(E-Mail Removed)> wrote in message
news:Xns97237BBF763D6eejj99@194.109.133.242...
> Davey wrote on 05 dec 2005 in microsoft.public.inetserver.asp.general:
>
> > I have some code that divides a number and then prints this number. It
> > performs a cost rollup basically and then adds a percentage. The code
> > works fine except that the number returned has many figures afert the
> > decimal point (as you would expect really)
> > How can I remove these ? I am not really concerned about rounding up
> > or down, just removing to give me a whole number....

>
> If you are programming in ASP-vbScript:
>
> formatnumber()
>
> This is very basic, please read up on vbscript internal functions.
>
> --
> Evertjan.
> The Netherlands.
> (Replace all crosses with dots in my emailaddress)
>



 
Reply With Quote
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      12-06-2005
It's because you are not looking at the correct Regional Settings. When you
look at Regional Settings, you are looking at your OWN settings. ASP runs
under a different user account. The default user account settings is US. You
should consider setting LCID in your application:
http://www.aspfaq.com/show.asp?id=2260

Davey wrote:
> Hi Evertjan,
>
> I have used the FormatNumber() as you suggest. However, I am also
> using the FormatCurrency() to display a cost as currency. This works
> fine but I get different currency symbols on different servers !
> I have checked the Regional Settings in control on both servers and
> they are both set the same, but one displays $, and the other
> displays ....
> Any ideas why this should be ??
>
> Cheers
> Davey
>
>
> "Evertjan." <(E-Mail Removed)> wrote in message
> news:Xns97237BBF763D6eejj99@194.109.133.242...
>> Davey wrote on 05 dec 2005 in
>> microsoft.public.inetserver.asp.general:
>>
>>> I have some code that divides a number and then prints this number.
>>> It performs a cost rollup basically and then adds a percentage. The
>>> code works fine except that the number returned has many figures
>>> afert the decimal point (as you would expect really)
>>> How can I remove these ? I am not really concerned about rounding up
>>> or down, just removing to give me a whole number....

>>
>> If you are programming in ASP-vbScript:
>>
>> formatnumber()
>>
>> This is very basic, please read up on vbscript internal functions.
>>
>> --
>> Evertjan.
>> The Netherlands.
>> (Replace all crosses with dots in my emailaddress)


--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


 
Reply With Quote
 
Evertjan.
Guest
Posts: n/a
 
      12-06-2005
Davey wrote on 06 dec 2005 in microsoft.public.inetserver.asp.general:
> "Evertjan." <(E-Mail Removed)> wrote in message
>> Davey wrote on 05 dec 2005 in
>> microsoft.public.inetserver.asp.general:
>>
>> > I have some code that divides a number and then prints this number.
>> > It performs a cost rollup basically and then adds a percentage. The
>> > code works fine except that the number returned has many figures
>> > afert the decimal point (as you would expect really)
>> > How can I remove these ? I am not really concerned about rounding
>> > up or down, just removing to give me a whole number....

>>
>> If you are programming in ASP-vbScript:
>>
>> formatnumber()
>>
>> This is very basic, please read up on vbscript internal functions.
>>


[please do not toppost on usenet]

> I have used the FormatNumber() as you suggest. However, I am also
> using the FormatCurrency() to display a cost as currency. This works
> fine but I get different currency symbols on different servers !
> I have checked the Regional Settings in control on both servers and
> they are both set the same, but one displays $, and the other displays
> .... Any ideas why this should be ??


Never use FormatCurrency() in an internet setting, as both the server
regional settings and the clients available fonts have influence.

<% = "&nbsp;" & FormatNumber(yourGainOrLoss,2) %>

will do what you(?) want.

In general avoid coding that is dependent on regional settings,
though both the decimal and thousands character
are influenced by it in FormatNumber()

1.234,56

or

1,234.56

or ....



--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

 
Reply With Quote
 
Davey
Guest
Posts: n/a
 
      12-07-2005
Thanks Evertjan.

I see what you mean with using the FormatCurrency.

Thankyou for your help
Cheers
Davey


"Evertjan." <(E-Mail Removed)> wrote in message
news:Xns97249DF46A616eejj99@194.109.133.242...
> Davey wrote on 06 dec 2005 in microsoft.public.inetserver.asp.general:
> > "Evertjan." <(E-Mail Removed)> wrote in message
> >> Davey wrote on 05 dec 2005 in
> >> microsoft.public.inetserver.asp.general:
> >>
> >> > I have some code that divides a number and then prints this number.
> >> > It performs a cost rollup basically and then adds a percentage. The
> >> > code works fine except that the number returned has many figures
> >> > afert the decimal point (as you would expect really)
> >> > How can I remove these ? I am not really concerned about rounding
> >> > up or down, just removing to give me a whole number....
> >>
> >> If you are programming in ASP-vbScript:
> >>
> >> formatnumber()
> >>
> >> This is very basic, please read up on vbscript internal functions.
> >>

>
> [please do not toppost on usenet]
>
> > I have used the FormatNumber() as you suggest. However, I am also
> > using the FormatCurrency() to display a cost as currency. This works
> > fine but I get different currency symbols on different servers !
> > I have checked the Regional Settings in control on both servers and
> > they are both set the same, but one displays $, and the other displays
> > .... Any ideas why this should be ??

>
> Never use FormatCurrency() in an internet setting, as both the server
> regional settings and the clients available fonts have influence.
>
> <% = "?&nbsp;" & FormatNumber(yourGainOrLoss,2) %>
>
> will do what you(?) want.
>
> In general avoid coding that is dependent on regional settings,
> though both the decimal and thousands character
> are influenced by it in FormatNumber()
>
> ? 1.234,56
>
> or
>
> ? 1,234.56
>
> or ....
>
>
>
> --
> Evertjan.
> The Netherlands.
> (Replace all crosses with dots in my emailaddress)
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: [SI] Knock, knock - Doors Robert Coe Digital Photography 1 06-06-2012 12:40 AM
Knock...!!! Knock...!!! New Offer... Chinmay C Programming 0 04-26-2008 02:23 AM
Knock...!!! Knock...!!! New Offer... Chinmay C Programming 0 04-26-2008 02:22 AM
Knock, knock *stella* Javascript 0 05-19-2005 03:12 PM
Knock, Knock (OT) Starstuffed Computer Support 1 09-10-2003 08:10 PM



Advertisments