anault24
asked on
Help with Parallel array coding Visual Basic
Here I have the code for this visual basic exercise I am working on. I need help coding the btnDisplay event. I need to store the minimum points I have listed below into a 5-element, one-dimensional integer array named intPoints. Also, for the grades that I have listed below I need a 5-element, one-dimensional string array named strGrades. The arrays should be parallel arrays. The procedure should search the intPoints array for for the number of points entered by the user, and then display the corresponding grade from the strGrades array.
Minimum Points Maximum Points Grade
0 299 F
300 349 D
350 399 C
400 449 B
450 500 A
Public Class frmMain
Private Sub btnExit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnExit.Click
Me.Close()
End Sub
Private Sub txtPoints_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtPoints.Enter
txtPoints.SelectAll()
End Sub
Private Sub txtPoints_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPr essEventAr gs) Handles txtPoints.KeyPress
' accepts only numbers and the Backspace key
If (e.KeyChar < "0" OrElse e.KeyChar > "9") AndAlso e.KeyChar <> ControlChars.Back Then
e.Handled = True
End If
End Sub
Private Sub txtPoints_TextChanged(ByVa l sender As Object, ByVal e As System.EventArgs) Handles txtPoints.TextChanged
lblGrade.Text = String.Empty
End Sub
Private Sub btnDisplay_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDisplay.Click
End Sub
End Class
Minimum Points Maximum Points Grade
0 299 F
300 349 D
350 399 C
400 449 B
450 500 A
Public Class frmMain
Private Sub btnExit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnExit.Click
Me.Close()
End Sub
Private Sub txtPoints_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtPoints.Enter
txtPoints.SelectAll()
End Sub
Private Sub txtPoints_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPr
' accepts only numbers and the Backspace key
If (e.KeyChar < "0" OrElse e.KeyChar > "9") AndAlso e.KeyChar <> ControlChars.Back Then
e.Handled = True
End If
End Sub
Private Sub txtPoints_TextChanged(ByVa
lblGrade.Text = String.Empty
End Sub
Private Sub btnDisplay_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDisplay.Click
End Sub
End Class
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.