📄 frmeditsubject.frm
字号:
VERSION 5.00
Begin VB.Form FrmEditSubject
Caption = "编辑单选题"
ClientHeight = 6540
ClientLeft = 60
ClientTop = 345
ClientWidth = 8805
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 6540
ScaleWidth = 8805
StartUpPosition = 1 '所有者中心
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 = 2340
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "ChoiceExercise"
Top = 6165
Visible = 0 'False
Width = 2175
End
Begin VB.CommandButton Command1
Caption = "返回"
Height = 375
Index = 7
Left = 7065
TabIndex = 19
Top = 5715
Width = 1185
End
Begin VB.TextBox Text1
Height = 315
Index = 5
Left = 1170
MaxLength = 1
TabIndex = 18
Top = 5715
Width = 690
End
Begin VB.CommandButton Command1
Caption = "更新"
Enabled = 0 'False
Height = 375
Index = 6
Left = 5130
TabIndex = 17
Top = 5715
Width = 510
End
Begin VB.CommandButton Command1
Caption = "删除"
Height = 375
Index = 5
Left = 4590
TabIndex = 16
Top = 5715
Width = 510
End
Begin VB.CommandButton Command1
Caption = "编辑"
Height = 375
Index = 4
Left = 4050
TabIndex = 15
Top = 5715
Width = 510
End
Begin VB.CommandButton Command1
Caption = ">>"
Height = 375
Index = 3
Left = 3600
TabIndex = 14
Top = 5715
Width = 420
End
Begin VB.CommandButton Command1
Caption = ">"
Height = 375
Index = 2
Left = 3150
TabIndex = 13
Top = 5715
Width = 420
End
Begin VB.CommandButton Command1
Caption = "<"
Height = 375
Index = 1
Left = 2700
TabIndex = 12
Top = 5715
Width = 420
End
Begin VB.CommandButton Command1
Caption = "<<"
Height = 375
Index = 0
Left = 2250
TabIndex = 11
Top = 5715
Width = 420
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 780
Index = 0
Left = 1125
TabIndex = 4
Top = 540
Width = 7260
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 780
Index = 1
Left = 1125
TabIndex = 3
Top = 1530
Width = 7260
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 780
Index = 2
Left = 1125
TabIndex = 2
Top = 2565
Width = 7260
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 780
Index = 3
Left = 1125
TabIndex = 1
Top = 3600
Width = 7260
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 780
Index = 4
Left = 1125
TabIndex = 0
Top = 4635
Width = 7260
End
Begin VB.Label Label2
Caption = "Label2"
Height = 330
Left = 1125
TabIndex = 20
Top = 90
Width = 3165
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "题目:"
Height = 180
Index = 0
Left = 405
TabIndex = 10
Top = 585
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "答案A:"
Height = 180
Index = 1
Left = 405
TabIndex = 9
Top = 1575
Width = 630
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "答案B:"
Height = 180
Index = 2
Left = 405
TabIndex = 8
Top = 2610
Width = 630
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "答案C:"
Height = 180
Index = 3
Left = 405
TabIndex = 7
Top = 3645
Width = 630
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "答案D:"
Height = 180
Index = 4
Left = 405
TabIndex = 6
Top = 4680
Width = 630
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "正确答案为:"
Height = 180
Index = 5
Left = 45
TabIndex = 5
Top = 5805
Width = 1080
End
End
Attribute VB_Name = "FrmEditSubject"
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
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(6) = JiaMi(Text1(5), 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
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 = JieMi(Data1.Recordset.Fields(6), Data1.Recordset("key"))
Label2.Caption = "第 " & Data1.Recordset.AbsolutePosition + 1 & " 题/共 " & Data1.Recordset.RecordCount & " 题"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -