I am working on a project and have most of the code completed, but with many errors. The Calculate button is supposed to display:
- the accessories and finish minus the entered base price in subtotal
- display the subtotal plus salestax in the total control
-display the total minus the entered trade-in price in an amount due control
I thought i understood everything, but the further I went, the more lost and confused I got. Please let me know how I can fix my errors, some of which are listed below:
-Identifier expected
-Operator '+' is not defined for types 'System.Windows.Forms.TextBox' and 'System.Windows.Forms.TextBox'.
All of the operator I used show similar errors. how do I fix this, and the other error? The code is shown below, and i have attached what I have completed.
Public Class Form1
Private sub
Dim Stereo As Decimal
Dim Leather As Decimal
Dim CompNav As Decimal
Dim ExteriorFinish As Decimal
Dim TaxRate As Decimal
'Get the price of selected accessory or accessories
If stereoCheckBox.Checked Then
Stereo = 425.76
Else
Stereo = 0
End If
If leatherCheckBox.Checked Then
Leather = 987.41
Else
Leather = 0
End If
If navigationCheckBox.Checked Then
CompNav = 1741.23
Else
CompNav = 0
End If
'Get the price of selected exterior finish
If standardRadioButton.Checked Then
ExteriorFinish = 0
ElseIf pearlizedRadioButton.Checked Then
ExteriorFinish = 345.72
ElseIf customRadioButton.Checked Then
ExteriorFinish = 599.99
End If
'Calculate total of selected accessories and finish
accessoriesFinish = Stereo + Leather + CompNav + ExteriorFinish
accessoriesFinishTextBox = FormatNumber(accessoriesFinish)
End Sub
Private Sub subtotalTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles subtotalTextBox.TextChanged
'Calculate subtotal of accessories and finish and base price
subtotalTextBox = salesPriceTextBox + accessoriesFinishTextBox
End Sub
Private Sub salesTaxTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles salesTaxTextBox.TextChanged
'Calculate the sales tax on the subtotal
salesTaxTextBox = subtotalTextBox * 0.08
End Sub
Private Sub totalTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles totalTextBox.TextChanged
'Calculate the sum of the subtotal and the sales tax
totalTextBox = subtotalTextBox + salesTaxTextBox
End Sub
Private Sub amountDueTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles amountDueTextBox.TextChanged
'Calculate the total minus the trade-in alllowance
amountDueTextBox = totalTextBox - tradeInTextBox
End Sub
Private Sub calculateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles calculateButton.Click
'Calculate the total minus the trade-in alllowance
amountDueTextBox = totalTextBox - tradeInTextBox
End Sub
End Class