Question: I need help with this code Public Class Form1 'Class level declarations Const decBASE_CHARGE As Decimal = 2000D 'Base charge includes two panels Const decADDITIONAL_PANEL

I need help with this code

Public Class Form1 'Class level declarations Const decBASE_CHARGE As Decimal = 2000D 'Base charge includes two panels Const decADDITIONAL_PANEL As Decimal = 300D 'Charge for each additional panel after first two Const dblEXPRESS_INSTALLATION As Double = 0.05 '5% charge for express installation

Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click

'This Procedure clears the form to reset For Each Control As Control In Me.gbCustomerInformation.Controls If TypeOf Control Is TextBox Then Control.Text = String.Empty

Next For Each Control As Control In Me.gbInstallationOptions.Controls If TypeOf Control Is TextBox Then Control.Text = String.Empty Next For Each Control As Control In Me.gbCharges.Controls If TypeOf Control Is TextBox Then Control.Text = String.Empty Next

End Sub Private Sub btnClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click 'Close the form Me.Close() End Sub

Private Sub btnCalculateCharges_Click(sender As Object, e As EventArgs) Handles btnCalculateCharges.Click 'This procedure caculates the total of an order. Dim decBaseCharge As Decimal 'Holds Base Charge Dim decAddPanels As Decimal 'Holds Base Charge Dim decTotalCost As Decimal 'Holds Total Cost Dim decDepositAmount As Decimal 'Holds Deposit Amount Dim decBalanceDue As Decimal 'Holds Balance Due

lblAddPanels.Text = decAddPanels.ToString("c") lblBalanceDue.Text = decBalanceDue.ToString("c") lblBaseCharge.Text = decBaseCharge.ToString("c") lblDepositAmount.Text = decDepositAmount.ToString("c") lblTotalCost.Text = decTotalCost.ToString("c")

Dim dblNumPanel As Double

If dblNumPanel <= 1 Then 'Ensure that user enters an integer between 1 and 1,000.

MsgBox("Input Error: Use a number between 1 and 1,000") txtNumPanels.Text = "" txtNumPanels.Focus() End If

If gbCharges.Visible Then gbCharges.Hide() Else gbCharges.Show() End If

'Ensure user enters iformation If txtFirstName.Text = String.Empty Then MsgBox("Enter First Name is field", MsgBoxStyle.OkOnly, "Error") txtFirstName.Focus() End If If txtLastName.Text = String.Empty Then MsgBox("Enter Last Name is field", MsgBoxStyle.OkOnly, "Error") txtLastName.Focus() End If If txtPhone.Text = String.Empty Then MsgBox("Enter Phone is field", MsgBoxStyle.OkOnly, "Error") txtPhone.Focus() End If

'calculate and return sale price Dim TotalCost As Decimal

If CInt(txtNumPanels.Text) >= 2 Then TotalCost = decBASE_CHARGE + ((decADDITIONAL_PANEL - 2) * 300)

Else TotalCost = decBASE_CHARGE

End If Return TotalCost

End Function

End Class

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!