Question: In this exercise, you modify the Check Digit application from this chapter's Apply lesson. Use Windows to make a copy of the Check Digit Solution
In this exercise, you modify the Check Digit application from this chapter's Apply lesson. Use Windows to make a copy of the Check Digit Solution folder. Rename the copy Check Digit SolutionForNext. Open the Check Digit Solution.sln file contained in the Check Digit SolutionForNext folder. Delete the EOCEXECNLintGrandTotal intTotalOdd intTotalEvenEOCEXECNL statement from the btnAssignClick procedure. Also delete the two Dim statements that declare the EOCEXECNLintTotalOddEOCEXECNL and EOCEXECNLintTotalEvenEOCEXECNL variables. Modify the procedure to use one For...Next loop rather than two For...Next loops to calculate the grand total. Save the solution and then start and test the application. If the user enters the btnAssignClick procedure should display
Here is my current code that needs to be modified:
Option Explicit On
Option Strict On
Option Infer Off
Public Class frmMain
Private Sub btnAssignClicksender As Object, e As EventArgs Handles btnAssign.Click
Assign a check digit to an ISBN.
Dim strIsbn As String
Dim intDigit As Integer
Dim intTotalOdd As Integer
Dim intTotalEven As Integer
Dim intGrandTotal As Integer
Dim intRemainder As Integer
Dim intCheckDigit As Integer
If txtIsbn.Text.Length Then
strIsbn txtIsbn.Text
For intOdd As Integer To Step
Integer.TryParsestrIsbnintOdd intDigit
intTotalOdd intDigit
Next intOdd
For intEven As Integer To Step
Integer.TryParsestrIsbnintEven intDigit
intTotalEven intDigit
intGrandTotal intTotalOdd intTotalEven
intRemainder intGrandTotal Mod
Next
If intRemainder Then
intCheckDigit intRemainder
End If
lblFinalIsbn.Text strIsbn & intCheckDigit.ToString
Else
MessageBox.ShowPlease enter numbers.", "Check Digit",
MessageBoxButtons.OK MessageBoxIcon.Information
End If
End Sub
Private Sub btnExitClicksender As Object, e As EventArgs Handles btnExit.Click
MeClose
End Sub
Private Sub txtIsbnEntersender As Object, e As EventArgs Handles txtIsbn.Enter
txtIsbn.SelectAll
End Sub
Private Sub txtIsbnTextChangedsender As Object, e As EventArgs Handles txtIsbn.TextChanged
lblFinalIsbn.Text String.Empty
End Sub
Private Sub txtIsbnKeyPresssender As Object, e As KeyPressEventArgs Handles txtIsbn.KeyPress
Allow only numbers and the Backspace key.
If eKeyChar OrElse eKeyChar AndAlso eKeyChar ControlChars.Back Then
eHandled True
End If
End Sub
End Class
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
