📄 frmeditoperation.frm
字号:
VERSION 5.00
Begin VB.Form FrmEditOperation
Caption = "编辑操作题库"
ClientHeight = 6630
ClientLeft = 60
ClientTop = 345
ClientWidth = 9120
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 6630
ScaleWidth = 9120
StartUpPosition = 1 '所有者中心
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 4515
Index = 0
Left = 990
TabIndex = 8
Top = 810
Width = 7260
End
Begin VB.CommandButton Command1
Caption = "<<"
Height = 375
Index = 0
Left = 2565
TabIndex = 7
Top = 5580
Width = 420
End
Begin VB.CommandButton Command1
Caption = "<"
Height = 375
Index = 1
Left = 3015
TabIndex = 6
Top = 5580
Width = 420
End
Begin VB.CommandButton Command1
Caption = ">"
Height = 375
Index = 2
Left = 3465
TabIndex = 5
Top = 5580
Width = 420
End
Begin VB.CommandButton Command1
Caption = ">>"
Height = 375
Index = 3
Left = 3915
TabIndex = 4
Top = 5580
Width = 420
End
Begin VB.CommandButton Command1
Caption = "编辑"
Height = 375
Index = 4
Left = 4365
TabIndex = 3
Top = 5580
Width = 510
End
Begin VB.CommandButton Command1
Caption = "删除"
Height = 375
Index = 5
Left = 4905
TabIndex = 2
Top = 5580
Width = 510
End
Begin VB.CommandButton Command1
Caption = "更新"
Enabled = 0 'False
Height = 375
Index = 6
Left = 5445
TabIndex = 1
Top = 5580
Width = 510
End
Begin VB.CommandButton Command1
Caption = "返回"
Height = 375
Index = 7
Left = 7020
TabIndex = 0
Top = 5625
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 = 2880
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "OperationExercise"
Top = 6075
Visible = 0 'False
Width = 2175
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "题目:"
Height = 180
Index = 0
Left = 270
TabIndex = 10
Top = 855
Width = 540
End
Begin VB.Label Label2
Caption = "Label2"
Height = 330
Left = 1080
TabIndex = 9
Top = 360
Width = 3165
End
End
Attribute VB_Name = "FrmEditOperation"
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.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)
Label2.Caption = "第 " & Data1.Recordset.AbsolutePosition + 1 & " 题/共 " & Data1.Recordset.RecordCount & " 题"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -