Click here to Skip to main content
15,886,806 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi guys I've come across this question and its got me absolutely stumped. i'm new to vb and have been learning it for 2 weeks but i cant get anywhere with this question


Add code so that when the user clicks the Pass / Fail button:
· If any text box contains invalid data, display the appropriate message from
Task 3 in the Status Box and stop the process.

Otherwise:
· If two or more scores have a value less than 5 display "Fail: 2 scores less
than 5" in the Status Box and stop the process.

Otherwise:
· Use the Sum of all Scores and the Category Code to display the word 'Pass'
or 'Fail' in the status box. The table below should be used in your calculation
Category Code Pass Mark
A 15
B 25
C 30
·


Examples:
o If Category is A and the Sum is 14 then the result is Fail
o If Category is A and the Sum is 15 then the result is Pass
o If Category is B and the Sum is 24 then the result is Fail
o If Category is B and the Sum is 25 then the result is Pass
o If Category is C and the Sum is 29 then the result is Fail
o If Category is C and the Sum is 30 then the result is Pass
Posted

1 solution

Well, we aren't going to do your homework.
Here's a skeleton of how it should look:
VB
Private Sub btnPassFail_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnPassFail.Click
   If (AnyTextBoxContainsInvalidData())
      '' TODO
   Else If (TwoOrMoreScoresHaveValueLessThanFive())
      '' TODO
   Else
      '' TODO
   EndIf
End Sub

Private Function AnyTextBoxContainsInvalidData() As Boolean
  '' TODO
End Function

Private Function TwoOrMoreScoresHaveValueLessThanFive() As Boolean
  '' TODO
End Function


Happy coding.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900