📄 form13.frm
字号:
VERSION 5.00
Begin VB.Form frmDanxuan
BackColor = &H00FFC0C0&
Caption = "单选题测试"
ClientHeight = 3150
ClientLeft = 60
ClientTop = 390
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3150
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame3
BackColor = &H00FFC0C0&
Caption = "题目"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 4935
Left = 3000
TabIndex = 18
Top = 720
Width = 4455
Begin VB.TextBox txtQuestion
Height = 4095
Left = 360
TabIndex = 19
Top = 600
Width = 3615
End
End
Begin VB.CommandButton cmdTrue
Caption = "正确答案"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 9960
TabIndex = 17
Top = 10200
Width = 2175
End
Begin VB.CommandButton cmdCheck
Caption = "核对答案"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 6960
TabIndex = 16
Top = 10200
Width = 2175
End
Begin VB.PictureBox Picture1
Height = 4935
Left = 7920
Picture = "Form13.frx":0000
ScaleHeight = 4875
ScaleWidth = 7155
TabIndex = 15
Top = 720
Width = 7215
End
Begin VB.CommandButton cmdClose
Caption = "关闭"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 12720
TabIndex = 14
Top = 10200
Width = 2415
End
Begin VB.Frame Frame2
BackColor = &H00FFC0C0&
Caption = "切换试题"
Enabled = 0 'False
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 3495
Left = 8280
TabIndex = 9
Top = 6240
Width = 6855
Begin VB.CommandButton cmdFirst
BackColor = &H00FFC0C0&
Caption = "第一题"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 720
TabIndex = 13
Top = 720
Width = 1815
End
Begin VB.CommandButton cmdLast
Caption = "最后一题"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 720
TabIndex = 12
Top = 1920
Width = 1815
End
Begin VB.CommandButton cmdNext
Caption = "下一题"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 3360
TabIndex = 11
Top = 720
Width = 2055
End
Begin VB.CommandButton cmdPrevious
Caption = "上一题"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 3360
TabIndex = 10
Top = 1920
Width = 2055
End
End
Begin VB.Frame Frame1
BackColor = &H00FFC0C0&
Caption = "答案"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 3975
Left = 3000
TabIndex = 0
Top = 5760
Width = 4455
Begin VB.TextBox txtD
Height = 495
Left = 840
TabIndex = 8
Top = 3000
Width = 3135
End
Begin VB.TextBox txtC
Height = 495
Left = 840
TabIndex = 7
Top = 2280
Width = 3135
End
Begin VB.TextBox txtB
Height = 495
Left = 840
TabIndex = 6
Top = 1440
Width = 3135
End
Begin VB.TextBox txtA
Height = 495
Left = 840
TabIndex = 5
Top = 720
Width = 3135
End
Begin VB.OptionButton optD
BackColor = &H00FFC0C0&
Caption = "D"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 240
TabIndex = 4
Top = 3000
Width = 735
End
Begin VB.OptionButton optC
BackColor = &H00FFC0C0&
Caption = "C"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 240
TabIndex = 3
Top = 2280
Width = 735
End
Begin VB.OptionButton optB
BackColor = &H00FFC0C0&
Caption = "B"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 240
TabIndex = 2
Top = 1440
Width = 735
End
Begin VB.OptionButton optA
BackColor = &H00FFC0C0&
Caption = "A"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 240
TabIndex = 1
Top = 720
Width = 735
End
End
End
Attribute VB_Name = "frmDanxuan"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdCheck_Click()
If optA.Value = True Then '如果所选为A时,正确答案为A和不为A的两种情况
If Rs!答案 = A Then
MsgBox "您回答正确", vbexlamation, "提示"
cmdTrue.Visible = False
cmdTrue.Enabled = False
Else
MsgBox "您回答错误", vbexlamation, "提示"
optA.Value = False
End If
Else
If optB.Value = True Then '如果所选为B时,正确答案为B和不为B的两种情况
If Rs!答案 = B Then
MsgBox "您回答正确", vbexlamation, "提示"
cmdTrue.Visible = False
cmdTrue.Enabled = False
Else
MsgBox "您回答错误", vbexlamation, "提示"
optB.Value = False
End If
Else
If optC.Value = True Then '如果所选为C时,正确答案为C和不为C的两种情况
If Rs!答案 = C Then
MsgBox "您回答正确", vbexlamation, "提示"
cmdTrue.Visible = False
cmdTrue.Enabled = False
Else
MsgBox "您回答错误", vbexlamation, "提示"
optC.Value = False
End If
Else
If optD.Value = True Then '如果所选为D时,正确答案为D和不为D的两种情况
If Rs!答案 = D Then
MsgBox "您回答正确", vbexlamation, "提示"
cmdTrue.Visible = False
cmdTrue.Enabled = False
Else
MsgBox "您回答错误", vbexlamation, "提示"
optD.Value = False
End If
End If
End Sub
Private Sub cmdClose_Click()
Unload Me
frmOdinaryUser.Show
End Sub
Private Sub cmdFirst_Click()
Rs.MoveFirst
Datashow
End Sub
Private Sub cmdLast_Click()
Rs.MoveLast
Datashow
End Sub
Private Sub cmdNext_Click()
Rs.MoveNext
If Rs.EOF Then
Rs.MoveFirst
End If
Datashow
End Sub
Private Sub cmdPrevious_Click()
Rs.MovePrevious
If Rs.BOF Then
Rs.MoveLast
End If
Datashow
End Sub
Private Sub cmdTrue_Click()
MsgBox "正确答案为:& Rs!正确答案 &", vbexlamation, "提示"
'Print "正确答案为:"; Rs!正确答案
End Sub
Private Sub Form_Load()
Call Module1.connection
Dim textsql As String
Dim MsgText As String
Dim Rs As New ADODB.Recordse
txtsql = "select * from 单选题表 "
Set Rs = ExecuteSQL(txtsql, MsgText)
txtQuestion.SetFocus
End Sub
Private Sub Datashow()
txtQuestion.Text = Rs!问题
txtA.Text = Rs!选项A
txtB.Text = Rs!选项B
txtC.Text = Rs!选项C
txtD.Text = Rs!选项D
End Sub
Private Sub Form_Unload(Cancel As Integer)
Rs.Close
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -