📄 frmtermedit.frm
字号:
VERSION 5.00
Begin VB.Form FrmTermEdit
BorderStyle = 1 'Fixed Single
Caption = "编辑学期信息"
ClientHeight = 1815
ClientLeft = 45
ClientTop = 330
ClientWidth = 4470
Icon = "FrmTermEdit.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1815
ScaleWidth = 4470
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame1
BackColor = &H80000004&
Height = 855
Left = 120
TabIndex = 2
Top = 120
Width = 4215
Begin VB.TextBox txtTerm
Height = 270
Left = 1080
MaxLength = 20
TabIndex = 3
Top = 315
Width = 2895
End
Begin VB.Label Label2
AutoSize = -1 'True
BackColor = &H00FFC0C0&
BackStyle = 0 'Transparent
Caption = "学期名称"
Height = 180
Left = 120
TabIndex = 4
Top = 360
Width = 720
End
End
Begin VB.CommandButton Cmd_Ok
Caption = "确 定"
Height = 400
Left = 765
MouseIcon = "FrmTermEdit.frx":0CCA
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 1
Top = 1200
Width = 1300
End
Begin VB.CommandButton Cmd_Cancel
Cancel = -1 'True
Caption = "取 消"
Height = 400
Left = 2370
MouseIcon = "FrmTermEdit.frx":0FD4
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 0
Top = 1200
Width = 1300
End
End
Attribute VB_Name = "FrmTermEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Modify As Boolean
Public OriName As String
Public OriId As Long
Private Sub Cmd_Cancel_Click()
Unload Me
End Sub
Private Sub Cmd_OK_Click()
'检查用户录入数据的有效性
If Trim(txtTerm) = "" Then
MsgBox "请输入学期名称"
Exit Sub
End If
'将新输入的数据保存到类变量中
With MyTerm
.TermName = MakeStr(txtTerm)
'根据变量Modify决定是插入新数据,还是修改已有的数据
If Modify = False Then '插入
'调用In_DB()函数判断用户输入的名称是否已经存在
If .In_DB(.TermName) = True Then
MsgBox Trim(txtTerm) + " 已经存在"
Exit Sub
End If
.Insert
Else '修改
If OriName <> Trim(txtTerm) Then
If .In_DB(Trim(txtTerm)) = True Then
MsgBox Trim(txtTerm) + " 已经存在"
Exit Sub
End If
End If
.Update (OriId)
End If
End With
MsgBox "编辑完成"
'关闭窗口
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -