Computing.Net > Forums > Programming > Decimal places in vb6

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Decimal places in vb6

Reply to Message Icon

Name: Ant Arde
Date: August 25, 2005 at 06:42:41 Pacific
OS: win Xp sp2
CPU/Ram: 512
Comment:

Please can someone help me, i need to get the value of AT to two decimal places instead of four thanks ant,ps.. these are all
currency variables

amt2 = CCur(Text29.Text)
vat = 1.14
AT = amt2 / vat
Text30.Text = AT



Sponsored Link
Ads by Google

Response Number 1
Name: StuartS
Date: August 25, 2005 at 11:06:22 Pacific
Reply:

AT = format(AT,"#0.00")

The zeros ensure that something is printed even if the value is Zero.

AT = 4.2 with produce 4.20

AT = 34.347 with produce 34.35
Format rounds up the the next number.

at = 0 will produce 0.00

You can do the same with the Round function but that ignores trailing zeros.

Stuart


0

Response Number 2
Name: wizard-fred
Date: August 25, 2005 at 22:47:17 Pacific
Reply:

A note of caution.

If these rounded values are to be used in subsequent calculations please correct the variables from which they are derived.

If these numbers appear in a financial statement or spreadsheet, can you testify to the accuracy of your work.

As a long time auditor of financial statements and spreadsheets. I have found errors in other peoples work that involved 10's of millions of dollars. It gets very embarassing if you have to retract you work in court or to the SEC. It might cost your company a lot.



0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Decimal places in vb6

Delphi convert to 2 decimal places www.computing.net/answers/programming/delphi-convert-to-2-decimal-places/9810.html

generate Crystal Report 9 in VB6 www.computing.net/answers/programming/generate-crystal-report-9-in-vb6/8845.html

getting decimal places vb6 formula www.computing.net/answers/programming/getting-decimal-places-vb6-formula/12754.html