Write components using ASP

Source: Internet
Author: User

Open VB and create an ax DLL. The project name is STR and the class name is count. Enter the following Code: Copy codeThe Code is as follows: public function add (byval A as double, byval B as double, byval C as integer, byval D as integer) as double
D = CINT (d)

If C = 1 then' plus
Add = formatnumber (a + B, d)
Elseif c = 2 then' minus
Add = formatnumber (a-B, d)
Elseif c = 3 then' Multiplication
Add = formatnumber (A * B, d)
Elseif c = 4 then' Division
Add = formatnumber (a/B, d)
End if

End Function

Parameter description: A and B are the values to be calculated, C is the calculation type, and D is the number of decimal places reserved.

Client ASP file code:

Copy codeThe Code is as follows: Set OBJ = server. Createobject ("str. Count ")
Dim C
C = obj. Add (455,45, 4,2)
Response. Write c

The execution result of the above Code is: 455 divided by 45, and the decimal point is accurate to the percentile.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.