填空选择题控件代码

填空题
判断按钮:
Private Sub CommandButton1_Click()
If TextBox1.Value = "云霄" Then
MsgBox "填写正确!", 0, "结果"
Else
MsgBox "填写错误!", 0, "提示"
End If
TextBox1.Value = ""
End Sub

帮助按钮:
Private Sub CommandButton2_Click()
MsgBox "正确答案为:云霄", 0, "提示"
End Sub


单选题

判断按钮:
Private Sub CommandButton1_Click()
If OptionButton3.Value = True Then
MsgBox "选择正确!", 0, "结果"
Else
MsgBox "选择错误!", 0, "提示"
End If
OptionButton1.Value = False
OptionButton2.Value = False
OptionButton3.Value = False
OptionButton4.Value = False
End Sub

帮助按钮:
Private Sub CommandButton2_Click()
MsgBox "正确答案是“C”,加把油哟!", 0, "帮助"
End Sub


多选题

判断按钮:
Private Sub CommandButton1_Click()
If CheckBox1.Value = True And CheckBox3.Value = True And CheckBox2.Value = False And CheckBox4.Value = False Then
MsgBox "选择正确!", 0, "结果"
Else
MsgBox "选择错误!", 0, "提示"
End If
CheckBox1.Value = False
CheckBox2.Value = False
CheckBox3.Value = False
CheckBox4.Value = False
End Sub

帮助按钮:
Private Sub CommandButton2_Click()
MsgBox "正确答案是“AC”,加把油哟!", 0, "提示"
End Sub

相关文档
最新文档