When a tax rate is applied to an item that is being
sold, there is an amount paid as extra besides the marked value of an
item. To calculate the tax amount, you use the tax rate and apply it on
the price of the item.
Start Microsoft Visual Basic and create a Standard EXE application
Save the application in a new folder named Tax Amount
Save the form as frmMain and save the project as TaxCalculation
Design the form as follows
Control
Name
Caption/Text
Additional Properties
Form
frmMain
Tax Amount Calculation
Border Style: 3 - FixedDialog
Label
Marked Price:
TextBox
txtMarkedPrice
0.00
Alignment: 1 -
Right Justify
Label
Tax Rate:
TextBox
txtTaxRate
5.75
Alignment: 1 -
Right Justify
Label
%
Button
cmdCalculate
C&alculate
Label
Tax Amount:
TextBox
txtTaxAmount
0.00
Alignment: 1 -
Right Justify
Label
Net Price:
Text Box
txtNetPrice
0.00
Alignment: 1 -
Right Justify
Button
cmdClose
&Close
Double-click the Close button and return to the form
Double-click the Calculate button
Implement the events as follows:
Option Explicit
Private Sub cmdCalculate_Click()
Dim MarkedPrice As Currency
Dim TaxRate As Double
Dim TaxAmount As Currency
Dim NetPrice As Currency
MarkedPrice = CCur(txtMarkedPrice.Text)
TaxRate = txtTaxRate.Text / 100
TaxAmount = MarkedPrice * TaxRate
NetPrice = MarkedPrice + TaxAmount
txtMarkedPrice.Text = FormatCurrency(MarkedPrice)
txtTaxAmount.Text = FormatCurrency(TaxAmount)
txtNetPrice.Text = FormatCurrency(NetPrice)
End Sub
Private Sub cmdClose_Click()
End
End Sub