0% found this document useful (0 votes)
43 views1 page

Exercise 7

This Visual Basic code counts the number of passing and failing grades entered by the user into a text box. It increments a pass counter for grades A-D and a fail counter for grades E-F. After 15 entries have been made, it displays the final pass and fail counts on two labels.

Uploaded by

api-307845299
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views1 page

Exercise 7

This Visual Basic code counts the number of passing and failing grades entered by the user into a text box. It increments a pass counter for grades A-D and a fail counter for grades E-F. After 15 entries have been made, it displays the final pass and fail counts on two labels.

Uploaded by

api-307845299
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Exercise #7

Public Class Form1


Dim pass As Integer
Dim fail As Integer

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button1.Click
Label3.Text = pass
Label5.Text = fail

If TextBox1.Text = "A" Then


pass = pass + 1
ElseIf TextBox1.Text = "a" Then
pass = pass + 1
ElseIf TextBox1.Text = "B" Then
pass = pass + 1
ElseIf TextBox1.Text = "b" Then
pass = pass + 1
ElseIf TextBox1.Text = "C" Then
pass = pass + 1
ElseIf TextBox1.Text = "c" Then
pass = pass + 1
ElseIf TextBox1.Text = "D" Then
pass = pass + 1
ElseIf TextBox1.Text = "d" Then
pass = pass + 1
ElseIf TextBox1.Text = "E" Then
fail = fail + 1
ElseIf TextBox1.Text = "e" Then
fail = fail + 1
ElseIf TextBox1.Text = "F" Then
fail = fail + 1
ElseIf TextBox1.Text = "f" Then
fail = fail + 1

End If

If pass + fail = 15 Then


pass = pass And
fail = fail

End If
End Sub
End Class

You might also like