?? frmdepedit.frm
字號:
Version 5.00
Begin VB.Form FrmDepEdit
BorderStyle = 1 'Fixed Single
Caption = "編輯部門信息"
ClientHeight = 3120
ClientLeft = 45
ClientTop = 330
ClientWidth = 4575
Icon = "FrmDepEdit.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3120
ScaleWidth = 4575
StartUpPosition = 2 'CenterScreen
Begin VB.Frame Frame1
Height = 2415
Left = 120
TabIndex = 4
Top = 120
Width = 4335
Begin VB.TextBox txtDep
Height = 270
Left = 1200
MaxLength = 20
TabIndex = 0
Top = 795
Width = 2895
End
Begin VB.TextBox txtDescribe
Height = 855
Left = 1200
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 1
Top = 1320
Width = 2895
End
Begin VB.Label Label2
AutoSize = -1 'True
BackColor = &H00FFC0C0&
BackStyle = 0 'Transparent
Caption = "部門名稱"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 120
TabIndex = 8
Top = 840
Width = 1020
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H00FFC0C0&
BackStyle = 0 'Transparent
Caption = "上級部門"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 120
TabIndex = 7
Top = 360
Width = 1020
End
Begin VB.Label lblUpper
AutoSize = -1 'True
BackColor = &H00FFC0C0&
BackStyle = 0 'Transparent
Caption = "上級部門"
Height = 180
Left = 1200
TabIndex = 6
Top = 360
Width = 720
End
Begin VB.Label Label3
AutoSize = -1 'True
BackColor = &H00FFC0C0&
BackStyle = 0 'Transparent
Caption = "功能描述"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 120
TabIndex = 5
Top = 1320
Width = 1020
End
End
Begin VB.Image Image4
Height = 300
Left = 2640
Picture = "FrmDepEdit.frx":0CCA
Top = 2640
Width = 300
End
Begin VB.Label LblCancel
BackStyle = 0 'Transparent
Caption = "取 消"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 3240
MouseIcon = "FrmDepEdit.frx":10E6
MousePointer = 99 'Custom
TabIndex = 3
Top = 2640
Width = 855
End
Begin VB.Image Image3
Height = 300
Left = 600
Picture = "FrmDepEdit.frx":13F0
Top = 2640
Width = 300
End
Begin VB.Label LblOK
BackStyle = 0 'Transparent
Caption = "確 定"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 1200
MouseIcon = "FrmDepEdit.frx":180C
MousePointer = 99 'Custom
TabIndex = 2
Top = 2640
Width = 735
End
End
Attribute VB_Name = "FrmDepEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Modify As Boolean
Private Sub LblCancel_Click()
Unload Me
End Sub
Private Sub LblOK_Click()
If Trim(txtDep) = "" Then
MsgBox "請輸入部門名稱"
Exit Sub
End If
'將新輸入的數據保存到類變量中
With MyDep
.Dep_name = MakeStr(txtDep)
.Describe = MakeStr(txtDescribe)
If Modify = False Then '插入
If .In_DB(.Dep_name, .UpperId) = True Then
MsgBox Trim(txtDep) + " 已經存在"
Exit Sub
End If
'CurDep中保存在部門管理窗體中選中的部門信息
'當插入新記錄時,新記錄將做為當前部門的下級部門
.UpperId = CurDep.Dep_Id
Bh = .Insert
'生成TreeView中一個結點的關鍵字
Tmp_Key = "a" + Trim(Str(Bh))
'設置結點的圖像
FrmDepMan.TreeView1.SelectedItem.Image = 1
FrmDepMan.TreeView1.SelectedItem.ExpandedImage = 2
FrmDepMan.TreeView1.SelectedItem.SelectedImage = 3
'在樹中添加一個結點
Set TmpNode = FrmDepMan.TreeView1.Nodes.Add(FrmDepMan.TreeView1.SelectedItem.Key, _
tvwChild, Tmp_Key, .Dep_name, 4, 5)
TmpNode.Selected = True
Else '修改
If CurDep.Dep_name <> Trim(txtDep) Then
If .In_DB(Trim(txtDep), .UpperId) = True Then
MsgBox Trim(txtDep) + " 已經存在"
Exit Sub
End If
End If
'當修改記錄時,不能改變上下級之間的關系
.UpperId = CurDep.UpperId
.Update (CurDep.Dep_Id)
If CurDep.Dep_name <> Trim(txtDep) Then
FrmDepMan.TreeView1.SelectedItem.Text = Trim(txtDep)
End If
'設置CurDep變量
CurDep.Dep_name = Trim(txtDep)
End If
End With
'關閉窗口
Unload Me
End Sub
Private Sub txtDep_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -