Here's the pic of my form
.For class size, small =$80, medium = $75, large = $70 and $35/per subject. I need to calculate the total. There're some problems with my code, can u guys give some suggestions please.
.For class size, small =$80, medium = $75, large = $70 and $35/per subject. I need to calculate the total. There're some problems with my code, can u guys give some suggestions please.
Code:
Private Sub btnCalculate_Click(sender As Object, e As EventArgs) Handles btnCalculate.Click
Dim dblTotal As Double
Dim checkedCheckBox As Integer = 0 'CheckBox checked
Dim totalCheckBox As Integer = 0 'Total CheckBox on Group Box
For Each myControl As CheckBox In Me.grpClassSize.Controls.OfType(Of CheckBox)()
If myControl.Checked Then
checkedCheckBox += 1
End If
totalCheckBox += 1
Next
If radSmall.Checked = True Then
If totalCheckBox = 1 Then
dblTotal = 80 * (35 * 1)
ElseIf totalCheckBox = 2 Then
dblTotal = 80 * (35 * 2)
ElseIf totalCheckBox = 3 Then
dblTotal = 80 * (35 * 3)
ElseIf totalCheckBox = 4 Then
dblTotal = 80 * (35 * 4)
End If
End If
If radMedium.Checked = True Then
If totalCheckBox = 1 Then
dblTotal = 75 * (35 * 1)
ElseIf totalCheckBox = 2 Then
dblTotal = 75 * (35 * 2)
ElseIf totalCheckBox = 3 Then
dblTotal = 75 * (35 * 3)
ElseIf totalCheckBox = 4 Then
dblTotal = 75 * (35 * 4)
End If
End If
If radLarge.Checked = True Then
If totalCheckBox = 1 Then
dblTotal = 70 * (35 * 1)
ElseIf totalCheckBox = 2 Then
dblTotal = 70 * (35 * 2)
ElseIf totalCheckBox = 3 Then
dblTotal = 70 * (35 * 3)
ElseIf totalCheckBox = 4 Then
dblTotal = 70 * (35 * 4)
End If
End If
lblTotal.Text = FormatCurrency(dblTotal, 2)
End Sub