Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ' Name: Grades Project
- ' Purpose: Display the number of times a letter appears in the array
- ' Programmer: <your name> on <current date>
- 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 btnCount_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCount.Click
- ' displays the number of times a specific
- ' letter appears in the array
- Dim strGrades() As String = {"C", "B", "C",
- "A", "b", "A",
- "F", "A", "D",
- "B", "C"}
- Dim strSearchFor As String
- Dim intCount As Integer ' counter
- strSearchFor = txtLetterGrade.LetterGrade.Text.Trim.ToUpper
- intCount = 0
- For intSub As Integer = 0 To strGrades.Length - 1
- If strGrades(intSub) = strSearchFor Then
- intCount += 1
- End If
- Next intSub
- MessageBox.Show(strSearchFor & ": " &
- intCount. ToString,
- "Grades" , MessageBoxButtons.OK,
- MessageBoxIcon.Asterisk Information)
- End Sub
- Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- End Sub
- Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
- End Sub
- End Class
Add Comment
Please, Sign In to add comment