Dim FrenchMark As Integer = 0
Dim GermanMark As Integer = 0
Dim SpanishMark As Integer = 0
Dim PercentageMark As Integer
Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
EnterMarks()
End Sub
Private Sub EnterMarks()
Try
FrenchMark = InputBox("Please enter a whole number between 1 and 30", "Enter French mark...")
If FrenchMark <= 1 Or FrenchMark >= 30 Then
MessageBox.Show("Please enter a whole number between 1 and 30!")
FrenchMark = 0
Exit Sub
End If
GermanMark = InputBox("Please enter a whole number between 1 and 30", "Enter German mark...")
If GermanMark <= 1 Or GermanMark >= 30 Then
MessageBox.Show("Please enter a whole number between 1 and 30!")
GermanMark = 0
Exit Sub
End If
SpanishMark = InputBox("Please enter a whole number between 1 and 30", "Enter Spanish mark...")
If SpanishMark <= 1 Or SpanishMark >= 30 Then
MessageBox.Show("Please enter a whole number between 1 and 30!")
SpanishMark = 0
Exit Sub
End If
Catch ex As Exception
MessageBox.Show("You can only enter numbers!")
Exit Sub
End Try
End Sub
Private Sub Button2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button2.Click
If FrenchMark = 0 Or GermanMark = 0 Or SpanishMark = 0 Then
MessageBox.Show("Please enter your marks first!")
Exit Sub
End If
ListBox1.Items.Add("French Mark: " & FrenchMark)
ListBox1.Items.Add("German Mark: " & GermanMark)
ListBox1.Items.Add("Spanish Mark: " & SpanishMark)
ListBox1.Items.Add("")
PercentageMark = ((FrenchMark + GermanMark + SpanishMark) / 90) * 100
If PercentageMark >= 50 Then
ListBox1.Items.Add("You have passed.")
ListBox1.Items.Add("Your percentage mark was " & PercentageMark)
Else
ListBox1.Items.Add("You have not passed.")
ListBox1.Items.Add("Your percentage mark was " & PercentageMark)
End If
End Sub
Danny_7 0 Newbie Poster
cgeier 187 Junior Poster
Danny_7 commented: Hey, i was asked by a teacher to use a listbox, anyways is that the pseudocode then yea? +0
Reverend Jim 4,968 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.