0% found this document useful (0 votes)
91 views

Exercise 7 Word

This code defines variables to store a student's grade, the number of passing students, and the number of failing students. When a button is clicked, it takes the grade from a textbox, checks if it is a letter between A-D (case insensitive), increments the passing counter if so or the failing counter if not, and updates labels to display the current passing and failing counts.

Uploaded by

api-310300017
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)
91 views

Exercise 7 Word

This code defines variables to store a student's grade, the number of passing students, and the number of failing students. When a button is clicked, it takes the grade from a textbox, checks if it is a letter between A-D (case insensitive), increments the passing counter if so or the failing counter if not, and updates labels to display the current passing and failing counts.

Uploaded by

api-310300017
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

Public Class Form1

Dim grades As Char


Dim num1 As Integer
Dim num2 As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
grades = TextBox1.Text
If grades = "A" Or grades = "B" Or grades = "C" Or grades = "D" Or grades = "a" Or grades
= "b" Or grades = "c" Or grades = "d" Then
num1 += 1
Label2.Text = "Number of students that passed = " + Str(num1)
Else
num2 += 1
Label3.Text = "Number of students that failed = " + Str(num2)
End If
End Sub
End Class

You might also like