Question
Clearly Visual Basic programming with Microsoft 2012 3rd edition Chapter 11 exercise 13 Help please, greatly appreciated Open the SwatTheBugs Solution(SwatTheBugs Solution.sln) file contained in
Clearly Visual Basic programming with Microsoft 2012 3rd edition
Chapter 11 exercise 13
Help please, greatly appreciated
Open the SwatTheBugs Solution(SwatTheBugs Solution.sln) file contained in the ClearlyVB2012\Chap11\SwatTheBugs Solution folder. Create a test data chart. Start and then test the application. Be sure to verify that the KeyPress event procedure works correctly. Locate and correct the errors in the code. Save the solution and then start and test the application.
Private Sub btnCalc_Click(sender As Object, e As EventArgs) Handles btnCalc.Click ' calculates and displays a bonus amount
Dim decSales As Decimal Dim decBonus As Decimal
' assign input to variables Decimal.TryParse(txtSales.Text, decSales)
' calculate bonus ' the bonus is 10% of the sales when the code is ' either 1 or 2 and the sales are over 10000 ' otherwise, the bonus is 5% If radCode1.Checked = True OrElse radCode2.Checked = True AndAlso decSales > 10000 Then decBonus = decSales * 0.1 Else decBonus = decSales * 0.05 End If
' display bonus lblBonus.Text = decBonus.ToString("C2") End Sub
Private Sub txtSales_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtSales.KeyPress ' allows the text box to accept only numbers, the period, ' and the Backspace key for editing
If e.KeyChar < "0" OrElse e.KeyChar > "9" AndAlso e.KeyChar <> "." AndAlso e.KeyChar <> ControlChars.Back Then e.Handled = True End If End Sub End Class
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started