📄 frmctypeedit.frm
字号:
VERSION 5.00
Begin VB.Form frmCTypeEdit
BorderStyle = 1 'Fixed Single
Caption = "借阅证件编辑"
ClientHeight = 3600
ClientLeft = 45
ClientTop = 435
ClientWidth = 4485
Icon = "frmCTypeEdit.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3600
ScaleWidth = 4485
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox txtCType
Height = 375
Left = 1800
MaxLength = 10
TabIndex = 0
Top = 120
Width = 1695
End
Begin VB.CommandButton cmdCancel
Cancel = -1 'True
Caption = "取 消"
Height = 495
Left = 2400
TabIndex = 7
Top = 2760
Width = 1215
End
Begin VB.CommandButton cmdOk
Caption = "确 定"
Height = 495
Left = 600
TabIndex = 6
Top = 2760
Width = 1215
End
Begin VB.TextBox txtTypeName
Height = 375
Left = 1800
MaxLength = 20
TabIndex = 1
Top = 600
Width = 1695
End
Begin VB.TextBox txtMaxCount
Alignment = 1 'Right Justify
Height = 375
Left = 1800
MaxLength = 5
TabIndex = 2
Text = "0"
Top = 1095
Width = 1695
End
Begin VB.TextBox txtMaxDays
Alignment = 1 'Right Justify
Height = 375
Left = 1800
MaxLength = 5
TabIndex = 3
Text = "0"
Top = 1590
Width = 1695
End
Begin VB.TextBox txtRenewDays
Alignment = 1 'Right Justify
Height = 375
Left = 1800
MaxLength = 5
TabIndex = 5
Text = "0"
Top = 2115
Width = 1695
End
Begin VB.Label lblCType
AutoSize = -1 'True
Caption = "类型编号"
Height = 180
Left = 840
TabIndex = 11
Top = 195
Width = 720
End
Begin VB.Label lblTypeName
AutoSize = -1 'True
Caption = "类型名称"
Height = 180
Left = 840
TabIndex = 10
Top = 675
Width = 720
End
Begin VB.Label lblMaxCount
AutoSize = -1 'True
Caption = "最大借阅数量"
Height = 180
Left = 480
TabIndex = 9
Top = 1155
Width = 1080
End
Begin VB.Label lblMaxDays
AutoSize = -1 'True
Caption = "最多借阅天数"
Height = 180
Left = 480
TabIndex = 8
Top = 1635
Width = 1080
End
Begin VB.Label lblRenewDays
AutoSize = -1 'True
Caption = "最多续借天数"
Height = 180
Left = 480
TabIndex = 4
Top = 2160
Width = 1080
End
End
Attribute VB_Name = "frmCTypeEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'确定按钮
Private Sub cmdOK_Click()
'================判断文本框的有效性==================
'是否输入借阅证类型名称
If Trim(txtTypeName.Text) = "" Then
MsgBox "请输入借阅证类型名称", vbInformation, "信息提示"
txtTypeName.SetFocus
Exit Sub
End If
'是否输入可借阅书籍的最大数目
If Trim(txtMaxCount.Text) = "" Then
MsgBox "请输入可借阅书籍的最大数目", vbInformation, "信息提示"
txtMaxCount.SetFocus
Exit Sub
End If
'输入可借阅书籍的最大数目是否合法
If Not IsNumeric(txtMaxCount.Text) Then
MsgBox "可借阅书籍的最大数目为数字" + vbCrLf _
+ "请输入正确的可借阅书籍的最大数目", vbInformation, "信息提示"
txtMaxCount.SetFocus
txtMaxCount.SelStart = 0
txtMaxCount.SelLength = Len(txtMaxCount.Text)
Exit Sub
End If
'是否输入可借阅书籍的最长时间
If Trim(txtMaxDays.Text) = "" Then
MsgBox "请输入可借阅书籍的最长时间", vbInformation, "信息提示"
txtMaxDays.SetFocus
Exit Sub
End If
'输入可借阅书籍的最长时间是否合法
If Not IsNumeric(txtMaxDays.Text) Then
MsgBox "可借阅书籍的最长时间为数字" + vbCrLf _
+ "请输入正确的可借阅书籍的最长时间", vbInformation, "信息提示"
txtMaxDays.SetFocus
txtMaxDays.SelStart = 0
txtMaxDays.SelLength = Len(txtMaxDays.Text)
Exit Sub
End If
'是否输入可续借书籍的最长时间
If Trim(txtRenewDays.Text) = "" Then
MsgBox "请输入可续借书籍的最长时间", vbInformation, "信息提示"
txtRenewDays.SetFocus
Exit Sub
End If
'输入可续借书籍的最长时间是否合法
If Not IsNumeric(txtRenewDays.Text) Then
MsgBox "可续借书籍的最长时间为数字" + vbCrLf _
+ "请输入正确的可续借书籍的最长时间", vbInformation, "信息提示"
txtRenewDays.SetFocus
txtRenewDays.SelStart = 0
txtRenewDays.SelLength = Len(txtRenewDays.Text)
Exit Sub
End If
'增加类型的判断
If IsAdd Then
'是否输入借阅证类型
If Trim(txtCType.Text) = "" Then
MsgBox "请输入借阅证类型", vbInformation, "信息提示"
Exit Sub
End If
'输入借阅证类型是否合法
If Not IsNumeric(txtCType.Text) Then
MsgBox "借阅证类型为数字" + vbCrLf _
+ "请输入正确的借阅证类型", vbInformation, "信息提示"
txtCType.SetFocus
txtCType.SelStart = 0
txtCType.SelLength = Len(txtCType.Text)
Exit Sub
End If
'判断是否存在此借阅证类型编号
If objCardType.IsExistCTypeID(txtCType.Text) Then
MsgBox "此借阅类型编号已存在" + vbCrLf _
+ "请输入其他借阅类型编号", vbInformation, "信息提示"
Exit Sub
End If
End If
'判断是否存在此借阅证类型名称
If objCardType.TypeName <> Trim(txtTypeName.Text) Then
If objCardType.IsExistTypeName(txtTypeName.Text) Then
MsgBox "此借阅类型名称已存在" + vbCrLf _
+ "请输入其他借阅类型名称", vbInformation, "信息提示"
Exit Sub
End If
End If
'===============判断文本框有效性结束=================
'给objCardType赋值
objCardType.CTypeID = Trim(txtCType.Text)
objCardType.TypeName = Trim(txtTypeName.Text)
objCardType.MaxCount = Round(Val(txtMaxCount.Text))
objCardType.MaxDays = Round(Val(txtMaxDays.Text))
objCardType.RenewDays = Round(Val(txtRenewDays.Text))
'========增加========
If IsAdd Then
objCardType.Insert
MsgBox "插入成功", vbInformation, "信息提示"
'========修改========
Else
objCardType.Update objCardType.CTypeID
MsgBox "修改成功", vbInformation, "信息提示"
End If
'关闭窗口
Unload Me
End Sub
'取消按钮
Private Sub cmdCancel_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -