我在我的代码行中不断出现这个错误,我似乎无法修复它。这是我的代码:
Public Class frmPresentTest
Dim correctAnswer As Double
Dim i As Int32
Dim wrongAnswer As Double
Dim responses As String (((noOfQuestions - 1) + 1) - 1)
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
TestGen.My.MyProject.Forms.frmTestGen.Show()
Me.Hide()
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
End Class
我在这行代码中不断收到错误:
暗淡响应为字符串 (((noOfQuestions - 1) + 1) - 1)
之前的第二个左括号noQuestions
。