In this exercise, you modify one of the Seminars applications from Chapter 4’s Apply lesson. Open the Seminars Solution.sln file contained in the Seminars Solution-CheckBox folder. Create an event-handling Sub procedure named ClearAmountDue and associate it with each check box’s CheckChanged event. Then, create a function that determines which (if any) check boxes are selected and then adds the associated fee to the total due. The function should return the total due to the statement that invoked it. Also, make the necessary modifications to the btnCalc_Click procedure’s code. Save the solution and then start and test the application. In VB please. Code Given: Option Explicit On Option Strict On Option Infer Off Public Class frmMain Private Sub btnCalc_Click(sender As Object, e As EventArgs) Handles btnCalc.Click ' Calculate and display the amount due. Dim intAmountDue As Integer ' Determine which (if any) check boxes are selected ' and add the associated fee to the amount due. If chkFinance.Checked = True Then intAmountDue = intAmountDue + 150 End If If chkHealth.Checked = True Then intAmountDue = intAmountDue + 125 End If If chkMarketing.Checked = True Then intAmountDue = intAmountDue + 135 End If lblAmountDue.Text = intAmountDue.ToString("C0") End Sub Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click Me.Close() End Sub Private Sub chkFinance_CheckedChanged(sender As Object, e As EventArgs) Handles chkFinance.CheckedChanged lblAmountDue.Text = String.Empty End Sub Private Sub chkHealth_CheckedChanged(sender As Object, e As EventArgs) Handles chkHealth.CheckedChanged lblAmountDue.Text = String.Empty End Sub Private Sub chkMarketing_CheckedChanged(sender As Object, e As EventArgs) Handles chkMarketing.CheckedChanged lblAmountDue.Text = String.Empty End Sub Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load End Sub End Class
In this exercise, you modify one of the Seminars applications from Chapter 4’s Apply lesson. Open the Seminars Solution.sln file contained in the Seminars Solution-CheckBox folder. Create an event-handling Sub procedure named ClearAmountDue and associate it with each check box’s CheckChanged event. Then, create a function that determines which (if any) check boxes are selected and then adds the associated fee to the total due. The function should return the total due to the statement that invoked it. Also, make the necessary modifications to the btnCalc_Click procedure’s code. Save the solution and then start and test the application. In VB please.
Code Given:
Option Explicit On
Option Strict On
Option Infer Off
Public Class frmMain
Private Sub btnCalc_Click(sender As Object, e As EventArgs) Handles btnCalc.Click
' Calculate and display the amount due.
Dim intAmountDue As Integer
' Determine which (if any) check boxes are selected
' and add the associated fee to the amount due.
If chkFinance.Checked = True Then
intAmountDue = intAmountDue + 150
End If
If chkHealth.Checked = True Then
intAmountDue = intAmountDue + 125
End If
If chkMarketing.Checked = True Then
intAmountDue = intAmountDue + 135
End If
lblAmountDue.Text = intAmountDue.ToString("C0")
End Sub
Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
Me.Close()
End Sub
Private Sub chkFinance_CheckedChanged(sender As Object, e As EventArgs) Handles chkFinance.CheckedChanged
lblAmountDue.Text = String.Empty
End Sub
Private Sub chkHealth_CheckedChanged(sender As Object, e As EventArgs) Handles chkHealth.CheckedChanged
lblAmountDue.Text = String.Empty
End Sub
Private Sub chkMarketing_CheckedChanged(sender As Object, e As EventArgs) Handles chkMarketing.CheckedChanged
lblAmountDue.Text = String.Empty
End Sub
Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
End Class
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 6 images