📄 frmaddmanychoice.frm
字号:
VERSION 5.00
Begin VB.Form FrmAddMultiChoice
Caption = "多项选择题入库"
ClientHeight = 8115
ClientLeft = 60
ClientTop = 345
ClientWidth = 8955
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 8115
ScaleWidth = 8955
StartUpPosition = 1 '所有者中心
Begin VB.CheckBox Check1
Caption = "F"
Height = 285
Index = 5
Left = 3555
TabIndex = 23
Top = 6975
Width = 555
End
Begin VB.CheckBox Check1
Caption = "E"
Height = 285
Index = 4
Left = 3105
TabIndex = 22
Top = 6975
Width = 555
End
Begin VB.CheckBox Check1
Caption = "D"
Height = 285
Index = 3
Left = 2655
TabIndex = 21
Top = 6975
Width = 555
End
Begin VB.CheckBox Check1
Caption = "C"
Height = 285
Index = 2
Left = 2205
TabIndex = 20
Top = 6975
Width = 555
End
Begin VB.CheckBox Check1
Caption = "B"
Height = 285
Index = 1
Left = 1755
TabIndex = 19
Top = 6975
Width = 555
End
Begin VB.CheckBox Check1
Caption = "A"
Height = 285
Index = 0
Left = 1305
TabIndex = 18
Top = 6975
Width = 555
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 780
Index = 6
Left = 1125
TabIndex = 16
Top = 5895
Width = 7260
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 780
Index = 5
Left = 1125
TabIndex = 14
Top = 5085
Width = 7260
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 780
Index = 0
Left = 1125
TabIndex = 7
Top = 1035
Width = 7260
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 780
Index = 1
Left = 1125
TabIndex = 6
Top = 1845
Width = 7260
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 780
Index = 2
Left = 1125
TabIndex = 5
Top = 2655
Width = 7260
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 780
Index = 3
Left = 1125
TabIndex = 4
Top = 3465
Width = 7260
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 780
Index = 4
Left = 1125
TabIndex = 3
Top = 4275
Width = 7260
End
Begin VB.CommandButton Command1
Caption = "入库"
Height = 375
Index = 0
Left = 5445
TabIndex = 2
Top = 7065
Width = 1320
End
Begin VB.CommandButton Command1
Caption = "取消"
Height = 375
Index = 1
Left = 6840
TabIndex = 1
Top = 7065
Width = 1320
End
Begin VB.Frame Frame1
Height = 150
Left = 135
TabIndex = 0
Top = 675
Width = 8520
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "答案F:"
Height = 180
Index = 7
Left = 450
TabIndex = 17
Top = 5940
Width = 630
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "答案E:"
Height = 180
Index = 6
Left = 405
TabIndex = 15
Top = 5130
Width = 630
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "题目:"
Height = 180
Index = 0
Left = 450
TabIndex = 13
Top = 1080
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "答案A:"
Height = 180
Index = 1
Left = 405
TabIndex = 12
Top = 1890
Width = 630
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "答案B:"
Height = 180
Index = 2
Left = 450
TabIndex = 11
Top = 2700
Width = 630
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "答案C:"
Height = 180
Index = 3
Left = 405
TabIndex = 10
Top = 3510
Width = 630
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "答案D:"
Height = 180
Index = 4
Left = 405
TabIndex = 9
Top = 4320
Width = 630
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "正确答案为:"
Height = 180
Index = 5
Left = 135
TabIndex = 8
Top = 7020
Width = 1080
End
Begin VB.Image Image1
Height = 480
Left = 270
Picture = "FrmAddManyChoice.frx":0000
Top = 90
Width = 480
End
End
Attribute VB_Name = "FrmAddMultiChoice"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Rs As ADODB.Recordset
Private Sub Command1_Click(Index As Integer)
Dim rsq As ADODB.Recordset
Dim qMsg$
Dim SQL$
Dim Result As String
Result = Empty
Result = CheckResult
Select Case Index
Case 0
For i = 0 To Text1.Count - 1
If Text1(i).Text = Empty Then
MsgBox "请填写完整信息", vbInformation, "提示"
Text1(i).SetFocus
Exit Sub
End If
Next i
If Result = Empty Then
MsgBox "请选择正确答案", vbInformation, "提示"
Exit Sub
End If
DBName = ChoiceExerciseDB
SQL = "select * from ChoiceExercise Where Subject= '" & Text1(0).Text & "'"
Set rsq = executeSQL(SQL, qMsg, DBName)
If qMsg = "查询正确" Then
MsgBox "已经有此题目", vbInformation, "提示"
Set rsq = Nothing
Exit Sub
End If
Rs.AddNew
Rs.Fields(0) = Text1(0).Text
Rs.Fields(1) = Text1(1).Text
Rs.Fields(2) = Text1(2).Text
Rs.Fields(3) = Text1(3).Text
Rs.Fields(4) = Text1(4).Text
Rs.Fields(5) = Text1(5).Text
Rs.Fields(6) = Text1(6).Text
Rs.Fields(8) = JiaMi(CheckResult, Rs.RecordCount)
Rs.Fields(9) = Rs.RecordCount
Rs.Update
If MsgBox("题目添加成功,是否继续添加", vbInformation + vbYesNo, "成功") = vbYes Then
For i = 0 To Text1.Count - 1
Text1(i).Text = Empty
Next i
Set Rs = Nothing
Else
Set Rs = Nothing
Unload Me
End If
Case 1
Me.Hide
End Select
End Sub
Private Sub Form_Load()
Dim Msg$
Dim SQL$
DBName = ChoiceExerciseDB
SQL = "select * from MultiChoice"
Set Rs = executeSQL(SQL, Msg, DBName)
End Sub
Function CheckResult() As String
Dim RIndex As Integer
For RIndex = 0 To Check1.Count - 1
If Check1(RIndex).Value = 1 Then
CheckResult = CheckResult & Check1(RIndex).Caption
End If
Next RIndex
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -