如何在VB中的测验问题上加总分?目前无法正常工作

时间:2014-03-04 00:26:49

标签: vb.net

这就是我设置一个标记测验问题的程序,但我只能获得总分1(如果第一个答案是正确的),而其他问题没有标记。 任何帮助将不胜感激。

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

1 个答案:

答案 0 :(得分:0)

您将FileOpenStatusTS设置为true,但之后再也没有将其设置为false,因此'if'语句只能评估为true一次