Guest User

Untitled

a guest
Jan 23rd, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. ' Name: Grades Project
  2. ' Purpose: Display the number of times a letter appears in the array
  3. ' Programmer: <your name> on <current date>
  4.  
  5. Public Class frmMain
  6.  
  7. Private Sub btnExit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnExit.Click
  8. Me.Close()
  9. End Sub
  10.  
  11. Private Sub btnCount_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCount.Click
  12. ' displays the number of times a specific
  13. ' letter appears in the array
  14.  
  15. Dim strGrades() As String = {"C", "B", "C",
  16. "A", "b", "A",
  17. "F", "A", "D",
  18. "B", "C"}
  19.  
  20. Dim strSearchFor As String
  21. Dim intCount As Integer ' counter
  22.  
  23. strSearchFor = txtLetterGrade.LetterGrade.Text.Trim.ToUpper
  24. intCount = 0
  25.  
  26. For intSub As Integer = 0 To strGrades.Length - 1
  27. If strGrades(intSub) = strSearchFor Then
  28. intCount += 1
  29. End If
  30. Next intSub
  31.  
  32. MessageBox.Show(strSearchFor & ": " &
  33. intCount. ToString,
  34. "Grades" , MessageBoxButtons.OK,
  35. MessageBoxIcon.Asterisk Information)
  36.  
  37.  
  38. End Sub
  39. Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  40.  
  41. End Sub
  42.  
  43. Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
  44.  
  45. End Sub
  46. End Class
Add Comment
Please, Sign In to add comment