📄 frmeditmultichoice.frm
字号:
VERSION 5.00
Begin VB.Form FrmEditMultiChoice
Caption = "编辑多选题"
ClientHeight = 8040
ClientLeft = 60
ClientTop = 345
ClientWidth = 8805
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 8040
ScaleWidth = 8805
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame1
Height = 150
Left = 90
TabIndex = 21
Top = 585
Width = 8520
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 780
Index = 4
Left = 945
TabIndex = 20
Top = 4140
Width = 7260
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 780
Index = 3
Left = 945
TabIndex = 19
Top = 3330
Width = 7260
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 780
Index = 2
Left = 945
TabIndex = 18
Top = 2520
Width = 7260
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 780
Index = 1
Left = 945
TabIndex = 17
Top = 1710
Width = 7260
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 780
Index = 0
Left = 945
TabIndex = 16
Top = 900
Width = 7260
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 780
Index = 5
Left = 945
TabIndex = 15
Top = 4950
Width = 7260
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 780
Index = 6
Left = 945
TabIndex = 14
Top = 5760
Width = 7260
End
Begin VB.CheckBox Check1
Caption = "A"
Height = 285
Index = 0
Left = 1350
TabIndex = 13
Top = 6885
Width = 510
End
Begin VB.CheckBox Check1
Caption = "B"
Height = 285
Index = 1
Left = 1845
TabIndex = 12
Top = 6885
Width = 555
End
Begin VB.CheckBox Check1
Caption = "C"
Height = 285
Index = 2
Left = 2385
TabIndex = 11
Top = 6885
Width = 555
End
Begin VB.CheckBox Check1
Caption = "D"
Height = 285
Index = 3
Left = 2970
TabIndex = 10
Top = 6885
Width = 555
End
Begin VB.CheckBox Check1
Caption = "E"
Height = 285
Index = 4
Left = 3510
TabIndex = 9
Top = 6885
Width = 555
End
Begin VB.CheckBox Check1
Caption = "F"
Height = 285
Index = 5
Left = 4140
TabIndex = 8
Top = 6885
Width = 555
End
Begin VB.CommandButton Command1
Caption = "<<"
Height = 375
Index = 0
Left = 2340
TabIndex = 7
Top = 7380
Width = 420
End
Begin VB.CommandButton Command1
Caption = "<"
Height = 375
Index = 1
Left = 2790
TabIndex = 6
Top = 7380
Width = 420
End
Begin VB.CommandButton Command1
Caption = ">"
Height = 375
Index = 2
Left = 3240
TabIndex = 5
Top = 7380
Width = 420
End
Begin VB.CommandButton Command1
Caption = ">>"
Height = 375
Index = 3
Left = 3690
TabIndex = 4
Top = 7380
Width = 420
End
Begin VB.CommandButton Command1
Caption = "编辑"
Height = 375
Index = 4
Left = 4140
TabIndex = 3
Top = 7380
Width = 510
End
Begin VB.CommandButton Command1
Caption = "删除"
Height = 375
Index = 5
Left = 4680
TabIndex = 2
Top = 7380
Width = 510
End
Begin VB.CommandButton Command1
Caption = "更新"
Enabled = 0 'False
Height = 375
Index = 6
Left = 5220
TabIndex = 1
Top = 7380
Width = 510
End
Begin VB.CommandButton Command1
Caption = "返回"
Height = 375
Index = 7
Left = 6660
TabIndex = 0
Top = 7380
Width = 1185
End
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = "F:\My Documents\VB\考试管理系统\服务器\examktl.dll"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 345
Left = 4050
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "MultiChoice"
Top = 7875
Visible = 0 'False
Width = 2175
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Height = 180
Left = 5310
TabIndex = 30
Top = 6930
Width = 90
End
Begin VB.Image Image1
Height = 480
Left = 225
Picture = "FrmEditMultiChoice.frx":0000
Top = 45
Width = 480
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "正确答案为:"
Height = 180
Index = 5
Left = 225
TabIndex = 29
Top = 6930
Width = 1080
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "答案D:"
Height = 180
Index = 4
Left = 225
TabIndex = 28
Top = 4185
Width = 630
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "答案C:"
Height = 180
Index = 3
Left = 225
TabIndex = 27
Top = 3375
Width = 630
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "答案B:"
Height = 180
Index = 2
Left = 225
TabIndex = 26
Top = 2565
Width = 630
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "答案A:"
Height = 180
Index = 1
Left = 225
TabIndex = 25
Top = 1755
Width = 630
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "题目:"
Height = 180
Index = 0
Left = 270
TabIndex = 24
Top = 945
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "答案E:"
Height = 180
Index = 6
Left = 225
TabIndex = 23
Top = 4995
Width = 630
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "答案F:"
Height = 180
Index = 7
Left = 225
TabIndex = 22
Top = 5805
Width = 630
End
End
Attribute VB_Name = "FrmEditMultiChoice"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim FristRun As Boolean
Private Sub Command1_Click(Index As Integer)
On Error Resume Next
Dim n As Integer
Dim UpResult As String
Select Case Index
Case 0
Data1.Recordset.MoveFirst
Case 1
If Data1.Recordset.AbsolutePosition <= 0 Then
MsgBox "已经是第一条记录!", vbInformation, "提示"
Data1.Recordset.MoveFirst
Exit Sub
End If
Data1.Recordset.MovePrevious
Case 2
If Data1.Recordset.AbsolutePosition = Data1.Recordset.RecordCount - 1 Then
MsgBox "已经是最后一条记录!", vbInformation, "提示"
Data1.Recordset.MoveLast
Exit Sub
End If
Data1.Recordset.MoveNext
Case 3
Data1.Recordset.MoveLast
Case 4
Command1(4).Enabled = False
Command1(6).Enabled = True
Case 5
If MsgBox("确认删除此题目吗?", vbInformation + vbYesNo, "提示") = vbYes Then
Data1.Recordset.Delete
Data1.Recordset.MoveFirst
Else
Exit Sub
End If
Case 6
Data1.Recordset.Edit
Data1.Recordset.Fields(0) = Text1(0)
Data1.Recordset.Fields(1) = Text1(1)
Data1.Recordset.Fields(2) = Text1(2)
Data1.Recordset.Fields(3) = Text1(3)
Data1.Recordset.Fields(4) = Text1(4)
Data1.Recordset.Fields(5) = Text1(5).Text
Data1.Recordset.Fields(6) = Text1(6).Text
For i = 0 To Check1.Count - 1
If Check1(i).Value = 1 Then
Select Case i
Case 0
UpResult = UpResult & "A"
Case 1
UpResult = UpResult & "B"
Case 2
UpResult = UpResult & "C"
Case 3
UpResult = UpResult & "D"
Case 4
UpResult = UpResult & "E"
Case 5
UpResult = UpResult & "F"
End Select
End If
Next i
Data1.Recordset("key") = Text2.Text
Data1.Recordset.Fields(8) = JiaMi(UpResult, Data1.Recordset("key"))
Data1.Recordset.Update
Command1(6).Enabled = False
Command1(4).Enabled = True
Case 7
If Command1(6).Enabled = True Then
If MsgBox("确认放弃修改?", vbInformation + vbYesNo, "提示") = vbYes Then
Unload Me
Exit Sub
End If
Else
Unload Me
Exit Sub
End If
Exit Sub
End Select
Call ViewRS
End Sub
Private Sub Form_Activate()
If FristRun = True Then
Data1.Recordset.MoveLast
Data1.Recordset.MoveFirst
Call ViewRS
FristRun = False
End If
End Sub
Private Sub Form_Load()
FristRun = True
Data1.DatabaseName = App.Path & "\" & ChoiceExerciseDB
End Sub
Sub ViewRS()
'On Error Resume Next
Dim Result As String
For i = 0 To Check1.Count - 1
Check1(i).Value = 0
Next i
Text1(0).Text = Data1.Recordset.Fields(0)
Text1(1).Text = Data1.Recordset.Fields(1)
Text1(2).Text = Data1.Recordset.Fields(2)
Text1(3).Text = Data1.Recordset.Fields(3)
Text1(4).Text = Data1.Recordset.Fields(4)
Text1(5).Text = Data1.Recordset.Fields(5)
Text1(6).Text = Data1.Recordset.Fields(6)
Result = JieMi(Data1.Recordset.Fields(8), Data1.Recordset("key"))
For i = 1 To Len(Result)
Select Case Mid(Result, i, 1)
Case "A"
Check1(0).Value = 1
Case "B"
Check1(1).Value = 1
Case "C"
Check1(2).Value = 1
Case "D"
Check1(3).Value = 1
Case "E"
Check1(4).Value = 1
Case "F"
Check1(5).Value = 1
End Select
Next i
Label2.Caption = "第 " & Data1.Recordset.AbsolutePosition + 1 & " 题/共 " & Data1.Recordset.RecordCount & " 题"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -