Question
Here is my code: Public Class FrmMain Const tax As Double = 0.0135 'declare the constant value 'declare the variable 'form load event Private Sub
Here is my code:
Public Class FrmMain Const tax As Double = 0.0135 'declare the constant value 'declare the variable 'form load event Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load CenterToScreen() 'center on the screen lblTotalDue.Text = "$0.00" 'set the label value End Sub 'button calculate event Private Sub btnCalc_Click(sender As Object, e As EventArgs) Handles btnCalc.Click Dim sales As Double If (Double.TryParse(txtSales.Text, sales)) Then Dim TotalDue = sales * tax 'calculate the total due with 1.35% tax lblTotalDue.Text = TotalDue.ToString("c2") 'display the value with 2 decimal place Else MessageBox.Show("Enter the correct value ") End If End Sub 'textchange event Private Sub TextChange_Click(sender As Object, e As EventArgs) Handles txtSales.TextChanged txtSales.BackColor = Color.Gray 'change the gray color of the text background End Sub 'Enter event Private Sub Enter_Click(sender As Object, e As EventArgs) Handles txtSales.Enter Dim sales As Double If (Double.TryParse(txtSales.Text, sales)) Then Dim TotalDue = sales * tax 'calculate the total due with 1.35% tax lblTotalDue.Text = TotalDue.ToString("c2") 'display the value with 2 decimal place Else MessageBox.Show("Enter the correct value ") End If End Sub 'Exit event Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click Me.Close() 'close the form End Sub End Class
In this exercise, you will complete the Property Tax application that you created in Exercise 3 in Chapter 2. a. Use Windows to copy the Tax Solution folder from the VB2017\Chapo2 folder to the VB2017\Chap03 folder. Open the Tax Solution.sin file contained in the VB2017\ Chap03\Tax Solution folder. You created a Planning Chart for this application in Chapter 2. Enter the three Option statements in the Code Editor window. One of the buttons in the interface should calculate and display the property tax; use either a flowchart or pseudocode to plan the button's Click event procedure. Code the procedure using variables and a named constant. Display the tax with a comma (if necessary), a dollar sign and two decimal places. Save the solution and then start and test the application. (If the assessed value is 87650, the tax is $1,183.28.) b. Now professionalize your interface by coding the text box's TextChanged and Enter event procedures. Save the solution and then start and test the applicationStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started