i. You are to keep grand totals for the Hours and Amount Due for each type of Package.
i. This requires three class-level variables for the Hours, i.e. one for the Package A hours, one for the Package B hours, and one for the Package C hours.
ii. Similarly, you will need three class-level variables for the Amounts.
j. Check the RadioButtons to see which Package is selected and add the Hours and Amount Due into the corresponding set of class-level variables.
k. Also, disable the “Accumulate” button.
6. When the “Reset” button is clicked, display a MessageBox asking to verify the reset:
l. Include “OK” and “CANCEL” buttons.
m. If “OK” clicked, then:
i. Clear all Textboxes & Labels.
ii. Reset all RadioButtons & CheckBoxes.
iii. Reset the title bar to its original value.
iv. Enable the “Validate” button.
v. Disable the “Calculate” and “Accumulate” buttons.
n. If “CANCEL” clicked, then leave the form alone and exit.
7. When the “Exit” button is clicked:
o. Use a MessageBox to display the grand totals for each type of Package.
p. Close the form.
that is what I need to do and this is what I have.
Expand|Select|Wrap|Line Numbers
- Private Sub btnCustomer_Click(sender As Object, e As EventArgs) Handles btnCustomer.Click
- btnCustomer.Enabled = True
- btnCharges.Enabled = False
- Dim lastName As String = Nothing
- Dim spaceCharPos As Integer = txtName.Text.IndexOf(" ")
- If spaceCharPos > -1 Then
- lastName = txtName.Text.Substring(spaceCharPos)
- End If
- If txtName.Text = String.Empty Then
- MessageBox.Show("Please enter your first and last name.")
- txtName.Focus()
- End If
- If txtName.Text.IndexOf(" ") = -1 Then
- MessageBox.Show("Please put a space between First and Last name.")
- End If
- Dim city As String = Nothing
- Dim commaCharPos As Integer = txtCityState.Text.IndexOf(",")
- If commaCharPos > -1 Then
- city = txtCityState.Text.Substring(0, commaCharPos)
- End If
- If txtCityState.Text = String.Empty Then
- MessageBox.Show("Please enter your City and State")
- txtCityState.Focus()
- End If
- If txtCityState.Text.IndexOf(",") = -1 Then
- MessageBox.Show("Please insert a comma between Clity & State.")
- End If
- Me.Text = lastName & " from " & city
- btnCustomer.Enabled = False
- btnCharges.Enabled = True
- btnTotals.Enabled = True
- End Sub
- Private Sub btnCharges_Click(sender As Object, e As EventArgs) Handles btnCharges.Click
- btnCharges.Enabled = True
- btnCustomer.Enabled = False
- Dim decTotal As Decimal
- Dim intHours As Integer
- Const decNonProfit As Decimal = 0.8D
- intHours = CInt(txtHours.Text)
- If CInt(txtHours.Text) > 744 Then
- MessageBox.Show("Monthly Hours Can't Exceed 744")
- txtHours.Text = String.Empty
- lblAmountDue.Text = String.Empty
- End If
- If radA.Checked = False Then
- ElseIf radB.Checked = False Then
- ElseIf radC.Checked = False Then
- MessageBox.Show("Please select an internet package to proceed")
- btnTotals.Enabled = False
- End If
- If radA.Checked Then
- If intHours > 10 Then
- decTotal = CDec((9.95 + ((intHours - 10) * 2)))
- ElseIf intHours <= 10 Then
- decTotal = CDec(9.95)
- End If
- End If
- If radB.Checked Then
- If intHours > 20 Then
- decTotal = CDec((14.95 + ((intHours - 20) * 1)))
- ElseIf intHours <= 20 Then
- decTotal = CDec(14.95)
- End If
- End If
- If radC.Checked Then
- decTotal = CDec(19.95)
- End If
- If chkNonProfit.Checked = True Then
- decTotal = decTotal * decNonProfit
- End If
- lblAmountDue.Text = decTotal.ToString("c")
- End Sub
- Private Sub btnReset_Click(sender As Object, e As EventArgs) Handles btnReset.Click
- radA.Checked = False
- radB.Checked = False
- radC.Checked = False
- chkNonProfit.Checked = False
- lblAmountDue.Text = String.Empty
- txtHours.Text = String.Empty
- txtName.Clear()
- txtCityState.Clear()
- txtName.Focus()
- btnCustomer.Enabled = True
- btnCharges.Enabled = False
- btnTotals.Enabled = False
- VarGetInput()
- End Sub
- Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
- Dim GrandTotal As Integer
- Dim decPackA, decPackB, decPackC As Decimal
- GrandTotal = CInt(decPackA + decPackB + decPackC)
- GrandTotal = CInt("Package A: " & decPackA.ToString("c"))
- GrandTotal = CInt("Package B: " & decPackB.ToString("c"))
- GrandTotal = CInt("Package C: " & decPackC.ToString("c"))
- GrandTotal = CInt("Grand Total:" & GrandTotal.ToString("C"))
- End Sub
- End Class