0

コードでエラーが発生し続けます。

Public Class frmPresentTest
    Dim correctAnswer As Double
    Dim i As Int32
    Dim wrongAnswer As Double
    Dim responses(((noOfQuestions - 1) + 1) - 1) As String

    Private Sub cmdFinished_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdFinished.Click
        Dim str1 As String = "Correct Answer     Your Answer"
        FindChecked(i)
        Dim num2 As Double = 0
        Dim num3 As Integer = (noOfQuestions - 1)
        Dim num1 As Integer = 0
        Do While (num1 <= num3)
            If (responses(num1) <> "*") Then
                If (responses(num1) = test(num1).correctAnswer) Then
                    num2 = (num2 + correctAnswer)
                Else
                    num2 = (num2 - wrongAnswer)
                End If
            End If
            str1 = New String() {str1 & "  " & test(num1).correctAnswer & "    " & responses(num1), " "}
            num1 = (num1 + 1)

        Loop
        str1 = str1 & " * indicates that you did answer that question "
        str1 = str1 & "  Your score is: " & num2.ToString()
        MsgBox(str1, MsgBoxStyle.OkOnly, "Test Results")
        tookTest = True
        frmTestGen.Show()
        Me.Hide()

    End Sub

    Private Sub cmdNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdNext.Click
        FindChecked(i)
        i = (i + 1)
        If (i = (noOfQuestions - 1)) Then
            cmdNext.Visible = False
            cmdFinished.Visible = True
        End If
        ShowQuestion(i)
    End Sub

    Public Sub FindChecked(ByRef i As Int32)
        If (OptA.Checked) Then
            responses(i) = "A"
        ElseIf (optB.Checked) Then
            responses(i) = "B"
        ElseIf (optC.Checked) Then
            responses(i) = "C"
        ElseIf (optD.Checked) Then
            responses(i) = "D"
        Else
            responses(i) = "*"
        End If
    End Sub

    Private Sub frmPresentTest_Activated(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Activated
        correctAnswer = (100 / noOfQuestions)
        wrongAnswer = (correctAnswer / 2)
        i = 0
        OptA.Checked = False
        cmdNext.Visible = True
        cmdFinished.Visible = False
        ShowQuestion(i)
    End Sub

    Public Sub ShowQuestion(ByVal i As Int32)
        lblCount.Text = (i + 1).ToString() & "."
        OptA.Checked = False
        optB.Checked = False
        optC.Checked = False
        optD.Checked = False
        lblQuestion.Text = test(i).question
        OptA.Text = test(i).choiceA
        optB.Text = test(i).choiceB
        optC.Text = test(i).choiceC
        optD.Text = test(i).choiceD
    End Sub

End Class

str1 = New String() {str1 & " " & test(num1).correctAnswer & " " & response(num1), " "}は、私が問題を抱えているものです。

4

2 に答える 2

0

これは、次のいずれかを行う方法を学ぶ必要があることを意味します。

  • Google を使用します (検索エンジンで回答できる「これはどういう意味ですか」という質問がいくつかあります)。
  • 先生に聞く
  • 仲間のクラスメートが独自の BlackJack ゲームを作成しているときに、過去 2 日間に SO から取得したすべてのコードを見てください。
于 2013-10-17T17:16:16.707 に答える