?? frmempsel.frm
字號:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "msadodc.ocx"
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Begin VB.Form FrmEmpSel
BorderStyle = 1 'Fixed Single
ClientHeight = 3840
ClientLeft = 15
ClientTop = 15
ClientWidth = 5760
ControlBox = 0 'False
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3840
ScaleWidth = 5760
StartUpPosition = 2 '屏幕中心
Begin VB.ComboBox ComboState
Height = 300
ItemData = "FrmEmpSel.frx":0000
Left = 3120
List = "FrmEmpSel.frx":0016
Style = 2 'Dropdown List
TabIndex = 0
Top = 120
Width = 2415
End
Begin MSDataListLib.DataList DataList1
Bindings = "FrmEmpSel.frx":0056
Height = 2400
Left = 3120
TabIndex = 1
Top = 600
Width = 2415
_ExtentX = 4260
_ExtentY = 4180
_Version = 393216
ListField = "Emp_Name"
BoundColumn = "Emp_Id"
End
Begin MSAdodcLib.Adodc AdoEmpNameList
Height = 330
Left = -360
Top = 3000
Visible = 0 'False
Width = 2535
_ExtentX = 4471
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 1
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 3
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "AdoEmpNameList"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSComctlLib.ImageList ImageList3
Left = 0
Top = 600
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483628
ImageWidth = 16
ImageHeight = 16
MaskColor = 16777215
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 5
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmEmpSel.frx":0090
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmEmpSel.frx":2A22
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmEmpSel.frx":53B4
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmEmpSel.frx":7D46
Key = ""
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmEmpSel.frx":A6D8
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.TreeView TreeView1
Height = 3015
Left = 120
TabIndex = 2
Top = 120
Width = 2895
_ExtentX = 5106
_ExtentY = 5318
_Version = 393217
HideSelection = 0 'False
LabelEdit = 1
Sorted = -1 'True
Style = 7
HotTracking = -1 'True
SingleSel = -1 'True
ImageList = "ImageList3"
BorderStyle = 1
Appearance = 1
MousePointer = 99
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
MouseIcon = "FrmEmpSel.frx":D06A
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 = 1800
MouseIcon = "FrmEmpSel.frx":D384
MousePointer = 99 'Custom
TabIndex = 4
Top = 3360
Width = 735
End
Begin VB.Image Image3
Height = 300
Left = 1200
Picture = "FrmEmpSel.frx":D68E
Top = 3360
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 = 3840
MouseIcon = "FrmEmpSel.frx":DAAA
MousePointer = 99 'Custom
TabIndex = 3
Top = 3360
Width = 855
End
Begin VB.Image Image4
Height = 300
Left = 3240
Picture = "FrmEmpSel.frx":DDB4
Top = 3360
Width = 300
End
End
Attribute VB_Name = "FrmEmpSel"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub ComboState_Click()
'根據ComboState的值刷新AdoEmpNameList,并更新DataList1的內容
AdoEmpNameList.RecordSource = "SELECT Emp_Id, Emp_Name FROM Employees WHERE Dep_Id=" _
+ Trim(Str(CurDep.Dep_Id)) + " And State=" + Trim(Str(ComboState.ListIndex + 1))
AdoEmpNameList.Refresh
DataList1.ReFill
DataList1_Click
End Sub
Private Sub DataList1_Click()
If DataList1.BoundText = "" Then
MyEmp.Init
Exit Sub
End If
'讀取當前員工信息到Myemp
MyEmp.GetInfo (DataList1.BoundText)
End Sub
Private Sub Form_Load()
AdoEmpNameList.ConnectionString = "driver={SQL Server};server=" + Trim(Server) + ";uid=" + Trim(User) + ";pwd=" + Trim(Password) + ";database=ERP"
AdoEmpNameList.RecordSource = "SELECT Emp_Id,Emp_Name FROM Employees ORDER BY Emp_Id"
AdoEmpNameList.Refresh
Dim TmpNode As Node
FocusDepName = "公司領導"
Focuskey = ""
'設置根結點
Set TmpNode = TreeView1.Nodes.Add(, , "a0", "部門信息", 1, 3)
TmpNode.Selected = True
TmpNode.ExpandedImage = 2
'調用函數將所有部門添加到TreeView1中
Call Add_DepToTree(TreeView1, "a0")
ComboState.ListIndex = 0
TreeView1_Click
End Sub
Private Sub LblCancel_Click()
Unload Me
End Sub
Private Sub LblOK_Click()
UpperEmp.Emp_Id = MyEmp.Emp_Id
UpperEmp.GetInfo (UpperEmp.Emp_Id)
Unload Me
End Sub
Private Sub TreeView1_Click()
Dim Focuskey As String
'根據關鍵字獲取部門信息
Focuskey = TreeView1.SelectedItem.Key
CurDep.Dep_name = TreeView1.SelectedItem.Text
CurDep.Dep_Id = Val(Right(TreeView1.SelectedItem.Key, Len(TreeView1.SelectedItem.Key) - 1))
If Focuskey = "a0" Then '根結點
AdoEmpNameList.RecordSource = "SELECT * FROM Employees WHERE Dep_Id<0"
AdoEmpNameList.Refresh
DataList1.ReFill
Exit Sub
End If
'如果包含子結點,則設置圖像格式
If CurDep.HaveSon(CurDep.Dep_Id) = False Then
TreeView1.SelectedItem.ExpandedImage = 4
TreeView1.SelectedItem.Image = 4
TreeView1.SelectedItem.SelectedImage = 5
End If
'讀取CurDep中的所有部門信息
CurDep.GetInfo (CurDep.Dep_Id)
'根據選擇的部門編號刷新AdoEmpNameList1,從而選擇符合條件的員工姓名
AdoEmpNameList.RecordSource = "SELECT Emp_Id, Emp_Name FROM Employees WHERE Dep_Id=" _
+ Trim(Str(CurDep.Dep_Id)) + " And State=" + Trim(Str(ComboState.ListIndex + 1))
AdoEmpNameList.Refresh
DataList1.ReFill
DataList1_Click
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -