📄 frmbtypeedit.frm
字号:
VERSION 5.00
Begin VB.Form frmBTypeEdit
BorderStyle = 1 'Fixed Single
Caption = "图书类型编辑"
ClientHeight = 3300
ClientLeft = 45
ClientTop = 435
ClientWidth = 5430
Icon = "frmBTypeEdit.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3300
ScaleWidth = 5430
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton cmdCancel
Cancel = -1 'True
Caption = "取 消"
Height = 495
Left = 2760
TabIndex = 3
Top = 2280
Width = 1215
End
Begin VB.CommandButton cmdOk
Caption = "确 定"
Default = -1 'True
Height = 495
Left = 1080
TabIndex = 2
Top = 2280
Width = 1215
End
Begin VB.TextBox txtTypeName
Height = 375
Left = 2400
MaxLength = 20
TabIndex = 1
Top = 1320
Width = 1815
End
Begin VB.Label lblUIDCaption
AutoSize = -1 'True
Caption = "上级图书类型"
Height = 180
Left = 840
TabIndex = 5
Top = 600
Width = 1080
End
Begin VB.Label lblTypeNameCaption
AutoSize = -1 'True
Caption = "图书类型名称"
Height = 180
Left = 840
TabIndex = 4
Top = 1440
Width = 1080
End
Begin VB.Label lblUID
AutoSize = -1 'True
Caption = "lblUID"
ForeColor = &H00FF0000&
Height = 180
Left = 2400
TabIndex = 0
Top = 600
Width = 540
End
End
Attribute VB_Name = "frmBTypeEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'确定按钮
Private Sub cmdOK_Click()
'判断是否输入图书分类名称
If Trim(txtTypeName) = "" Then
MsgBox "请输入图书分类名称", vbInformation, "信息提示"
txtTypeName.SetFocus
Exit Sub
End If
'===============添加操作========================
If IsAdd Then
'判断是否存在重复的图书分类名称
If objBookType.IsExistTypeName(txtTypeName.Text) Then
MsgBox Trim(txtTypeName) + "已经存在" + vbCrLf + "请输入其他分类名称", _
vbInformation, "信息提示"
Exit Sub
End If
'插入数据
If Trim(lblUID.Caption) = "" Then
objBookType.UID = 0
Else
objBookType.UID = objBookType.TypeID
End If
objBookType.TypeName = Trim(txtTypeName.Text)
objBookType.Insert
MsgBox "插入成功", vbInformation, "信息提示"
'得到自动编号信息
objBookType.GetInfo txtTypeName.Text
'生成tvwBType结点的关键字
Dim TreeKey As String
TreeKey = TREENAME + Trim(Str(objBookType.TypeID))
'在树中添加一个结点
Set tmpNode = frmBTypeMan.tvwBType.Nodes.Add(frmBTypeMan.tvwBType.SelectedItem.Key, _
tvwChild, TreeKey, objBookType.TypeName)
tmpNode.Selected = True
'=============结束插入操作======================
'===============修改操作========================
Else
'判断是否存在重复的图书分类名称
If objBookType.TypeName <> Trim(txtTypeName.Text) Then
If objBookType.IsExistTypeName(txtTypeName.Text) Then
MsgBox Trim(txtTypeName) + "已经存在" + vbCrLf + "请输入其他分类名称", _
vbInformation, "信息提示"
Exit Sub
End If
End If
'修改数据
objBookType.TypeName = Trim(txtTypeName.Text)
objBookType.Update objBookType.TypeID
MsgBox "修改成功", vbInformation, "信息提示"
'在树中修改所指定结点的内容
frmBTypeMan.tvwBType.SelectedItem.Text = objBookType.TypeName
End If
'=============结束修改操作======================
'关闭窗口
Unload Me
End Sub
'取消按钮
Private Sub cmdCancel_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -