我在做一个考试系统,要将做的答案和原来的正确答案进行比较,正确的答案是原来我连接的一个试题库里的一个字段,我用LABEL控件将它显示了,以单选题为例
If Option1.Value = True Then
i = "A"
ElseIf Option2.Value = True Then
i = "B"
ElseIf Option3.Value = True Then
i = "C"
ElseIf Option4.Value = True Then
i = "D"
End If
如何将i和LABEL里显示的正确答案进行比较,如果正确,分数(score)+1

解决方案 »

  1.   

    If i = Label1.Caption Then
    分数(score)+1End If
      

  2.   

    If Option1.Value Then
        i = "A"
    ElseIf Option2.Value Then
        i = "B"
    ElseIf Option3.Value Then
        i = "C"
    ElseIf Option4.Value Then
        i = "D"
    End IfIf i = LABEL.Caption Then
        score = score + 1
    End If
      

  3.   

    没有用的,我用一个文本框显示出来,score始终是为0 的啊,为什么啊,急!!!!
      

  4.   

    那可能是什么问题呢?
    我定义score为整型,score=1
      

  5.   

    可能是变量定义的位置不对Private Score As IntegerPrivate Sub Form_Load()
        Score = 60
    End SubPrivate Sub Command1_Click()
        Dim i As String
        
        If Option1.Value Then
            i = "A"
        ElseIf Option2.Value Then
            i = "B"
        ElseIf Option3.Value Then
            i = "C"
        ElseIf Option4.Value Then
            i = "D"
        End If
        
        If i = Label1.Caption Then
            Score = Score + 1
            Text1.Text = Score
        End If
    End Sub
      

  6.   

    if i=label1.caption then score=score+1