测验中的VB.Net答案检查器

时间:2015-01-26 18:13:08

标签: vb.net visual-studio-2010

请帮助我在测验检查中解决我的问题。我有4个选项显示在单选按钮中。所以我的问题是在我检查我的单选按钮并提交它后给我相应问题的分数,但在我再次单击提交按钮后,它在同一问题上添加了另一个分数。如何阻止我的检查员在同一问题上添加另一个分数?

这是我的代码。

Public Sub Check()
    If Check1.Text < 2 And Check2.Text < 2 And Check3.Text < 2 And Check4.Text < 2 Then
        If CorrectAns.Text = CoAnsDB.Text Then
            score = score + 1
        Else
            score = score + 0
        End If
    Else
        score = score + 0
    End If
End Sub

 Private Sub BtnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSubmit.Click
    Call Check()
    'Call CheckerB()
    'Call CheckerC()
    'Call CheckerD()
    MyScore.Text = score.ToString
    BtnSubmit.Enabled = False
    AnsA.Enabled = False
    AnsB.Enabled = False
    AnsC.Enabled = False
    AnsD.Enabled = False
End Sub

  Private Sub AnsA_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AnsA.CheckedChanged
    CorrectAns.Text = "A"

    If AnsA.Checked = True Then
        Check1.Text = Check1.Text + 1
    End If
    BtnSubmit.Enabled = True
End Sub

Private Sub AnsD_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AnsD.CheckedChanged
    CorrectAns.Text = "D"
    If AnsB.Checked = True Then
        Check4.Text = Check4.Text + 1
    End If
    BtnSubmit.Enabled = True
End Sub

Private Sub AnsC_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AnsC.CheckedChanged
    CorrectAns.Text = "C"
    If AnsC.Checked = True Then
        Check3.Text = Check3.Text + 1
    End If
    BtnSubmit.Enabled = True
End Sub

Private Sub AnsB_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AnsB.CheckedChanged
    CorrectAns.Text = "B"
    If AnsB.Checked = True Then
        Check2.Text = Check2.Text + 1
    End If
    BtnSubmit.Enabled = True
End Sub

谢谢。

0 个答案:

没有答案