Question

This is how I have set a procedure to mark the quiz questions, but I can only ever get a total score of 1 ( if the first answer is correct ) and the other questions are not marked. Any help would be appreciated.

Private Sub GetQuestions()

    questions = {{"General statements of what  a business intends to achieve.  Precise   details of those intentions are set out in objectives", "Corporate strategies", "Corporate objectives", "Aims / goals", "Aims / goals"}, _
            {"A statement of the overall   purpose of the business", "Mission statement", "Social responsibility", "Functional objectives", "Mission statement"},
            {"Objectives that relate to   the business as a whole.Usually set   by top management", "Business unit strategy", "Functional objectives", "Corporate objectives", "Corporate objectives"},
            {"The way in which a business   meets its responsibilities to society as a key external stakeholder", "SWOT analysis", "Social responsibility", "SMART objectives", "Social responsibility"},
            {"How a business attempts to   compete successfully in a particular market", "Business Objectives", "Business unit strategy", "SWOT analysis", "Business unit strategy"}}

End Sub


Private Sub MarkTest()
    FileClose(1)
    FileOpenStatusTS = False

    Dim Topic1Score As Integer = 0


    For i = 0 To 2

        If answers(i) = questions(i, 4) And FileOpenStatusTS = False Then

            Topic1Score += 1
            TotalScore += 1



            FileOpen(1, FilenameTS, OpenMode.Append)
            FileOpenStatusTS = True
            WriteLine(1, Username, Topic1Score)
            FileClose(1)

        End If

    Next

    LblQuestion.Text = "Well done the test has finished!"

    LblDefinition.Text = "You scored " & Topic1Score & " out of " & answers.Length & "!"

    Option1.Enabled = False

    Option2.Enabled = False
    Option3.Enabled = False

    btnPrev.Enabled = False

    btnNext.Enabled = False

End Sub

No correct solution

OTHER TIPS

You set FileOpenStatusTS to true, but then never set it to false again, so the 'if' statement can only evaluates to true once

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top