frmBase.frm
上传用户:yexiandon
上传日期:2022-07-12
资源大小:895k
文件大小:30k
- VERSION 5.00
- Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
- Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
- Begin VB.Form frmBase
- Caption = "部门职员信息"
- ClientHeight = 6675
- ClientLeft = 1860
- ClientTop = 5520
- ClientWidth = 15240
- Icon = "frmBase.frx":0000
- LinkTopic = "Form1"
- MDIChild = -1 'True
- ScaleHeight = 6675
- ScaleWidth = 15240
- WindowState = 2 'Maximized
- Begin MSComctlLib.ImageList imlViewSIcon
- Left = 2160
- Top = 6000
- _ExtentX = 1005
- _ExtentY = 1005
- BackColor = -2147483643
- ImageWidth = 16
- ImageHeight = 16
- MaskColor = 12632256
- _Version = 393216
- BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
- NumListImages = 6
- BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":08CA
- Key = "group"
- EndProperty
- BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":0D1C
- Key = "group2"
- EndProperty
- BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":34CE
- Key = "boy"
- EndProperty
- BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":3920
- Key = "girl"
- EndProperty
- BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":3D72
- Key = "sboy"
- EndProperty
- BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":41C6
- Key = "sgirl"
- EndProperty
- EndProperty
- End
- Begin MSComctlLib.ImageList imlViewBIcon
- Left = 1440
- Top = 6000
- _ExtentX = 1005
- _ExtentY = 1005
- BackColor = -2147483643
- ImageWidth = 32
- ImageHeight = 32
- MaskColor = 12632256
- _Version = 393216
- BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
- NumListImages = 16
- BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":461A
- Key = "boy"
- EndProperty
- BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":4A6C
- Key = "girl"
- EndProperty
- BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":4EBE
- Key = "bboy"
- EndProperty
- BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":5F12
- Key = "bgirl"
- EndProperty
- BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":6F66
- Key = "group"
- EndProperty
- BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":9718
- Key = "add"
- EndProperty
- BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":9B6A
- Key = "modify2"
- EndProperty
- BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":9FBC
- Key = "modify"
- EndProperty
- BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":A2D6
- Key = "del"
- EndProperty
- BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":A430
- Key = "info"
- EndProperty
- BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":A9CA
- Key = "info2"
- EndProperty
- BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":CC7C
- Key = "search"
- EndProperty
- BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":D216
- Key = "warn"
- EndProperty
- BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":D5B0
- Key = "setting"
- EndProperty
- BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":D8CA
- Key = "lstView"
- EndProperty
- BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":DBE4
- Key = "exit"
- EndProperty
- EndProperty
- End
- Begin MSComctlLib.ImageList ImageList1
- Left = 13560
- Top = 1320
- _ExtentX = 1005
- _ExtentY = 1005
- BackColor = -2147483643
- ImageWidth = 16
- ImageHeight = 16
- MaskColor = 12632256
- _Version = 393216
- BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
- NumListImages = 32
- BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":13E7E
- Key = "A2"
- EndProperty
- BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":14758
- Key = "A1"
- EndProperty
- BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":15222
- Key = "A0"
- EndProperty
- BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":15AFC
- Key = ""
- EndProperty
- BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":166A6
- Key = ""
- EndProperty
- BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":16C40
- Key = ""
- EndProperty
- BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":171DA
- Key = ""
- EndProperty
- BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":17774
- Key = "gb"
- EndProperty
- BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":182BE
- Key = ""
- EndProperty
- BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":1DEE0
- Key = ""
- EndProperty
- BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":1E47A
- Key = ""
- EndProperty
- BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":1E5D4
- Key = ""
- EndProperty
- BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":1E72E
- Key = ""
- EndProperty
- BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":1E888
- Key = "f5"
- EndProperty
- BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":1E9E2
- Key = ""
- EndProperty
- BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":1EB3C
- Key = "del"
- EndProperty
- BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":1EC96
- Key = "cz"
- EndProperty
- BeginProperty ListImage18 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":1EDF0
- Key = ""
- EndProperty
- BeginProperty ListImage19 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":1EF4A
- Key = "new"
- EndProperty
- BeginProperty ListImage20 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":1F4E4
- Key = "view"
- EndProperty
- BeginProperty ListImage21 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":1FA7E
- Key = ""
- EndProperty
- BeginProperty ListImage22 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":20018
- Key = "save"
- EndProperty
- BeginProperty ListImage23 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":205B2
- Key = "cute"
- EndProperty
- BeginProperty ListImage24 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":20B4C
- Key = "copy"
- EndProperty
- BeginProperty ListImage25 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":210E6
- Key = "paste"
- EndProperty
- BeginProperty ListImage26 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":21680
- Key = "xg"
- EndProperty
- BeginProperty ListImage27 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":21C1A
- Key = "serch"
- EndProperty
- BeginProperty ListImage28 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":221B4
- Key = "info"
- EndProperty
- BeginProperty ListImage29 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":2274E
- Key = ""
- EndProperty
- BeginProperty ListImage30 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":22CE8
- Key = ""
- EndProperty
- BeginProperty ListImage31 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":23282
- Key = ""
- EndProperty
- BeginProperty ListImage32 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmBase.frx":2381C
- Key = "exit"
- EndProperty
- EndProperty
- End
- Begin VB.PictureBox picSplitter
- BackColor = &H00808080&
- BorderStyle = 0 'None
- FillColor = &H00808080&
- Height = 4920
- Left = 2040
- ScaleHeight = 2142.379
- ScaleMode = 0 'User
- ScaleWidth = 780
- TabIndex = 6
- Top = 960
- Visible = 0 'False
- Width = 72
- End
- Begin MSComctlLib.TreeView tvTreeView
- Height = 4920
- Left = 0
- TabIndex = 5
- Top = 945
- Width = 2010
- _ExtentX = 3545
- _ExtentY = 8678
- _Version = 393217
- HideSelection = 0 'False
- Indentation = 529
- LabelEdit = 1
- Style = 7
- HotTracking = -1 'True
- SingleSel = -1 'True
- ImageList = "ImageList1"
- Appearance = 1
- End
- Begin MSComctlLib.ListView lvListView
- Height = 4920
- Left = 2055
- TabIndex = 4
- Top = 960
- Width = 14490
- _ExtentX = 25559
- _ExtentY = 8678
- View = 3
- LabelEdit = 1
- LabelWrap = -1 'True
- HideSelection = -1 'True
- FullRowSelect = -1 'True
- _Version = 393217
- Icons = "imlViewBIcon"
- SmallIcons = "imlViewSIcon"
- ColHdrIcons = "imlViewSIcon"
- ForeColor = -2147483640
- BackColor = -2147483643
- BorderStyle = 1
- Appearance = 1
- NumItems = 0
- End
- Begin VB.PictureBox picTitles
- Align = 1 'Align Top
- Appearance = 0 'Flat
- BorderStyle = 0 'None
- ForeColor = &H80000008&
- Height = 300
- Left = 0
- ScaleHeight = 300
- ScaleWidth = 15240
- TabIndex = 1
- TabStop = 0 'False
- Top = 585
- Width = 15240
- Begin VB.Label lblTitle
- BorderStyle = 1 'Fixed Single
- Caption = " 列表视图:"
- Height = 270
- Index = 1
- Left = 2078
- TabIndex = 3
- Tag = " 列表视图:"
- Top = 12
- Width = 3216
- End
- Begin VB.Label lblTitle
- BorderStyle = 1 'Fixed Single
- Caption = " 部门:"
- Height = 270
- Index = 0
- Left = 0
- TabIndex = 2
- Tag = " 树形视图:"
- Top = 12
- Width = 2016
- End
- End
- Begin MSComctlLib.Toolbar ToolBartb
- Align = 1 'Align Top
- Height = 585
- Left = 0
- TabIndex = 0
- Top = 0
- Width = 15240
- _ExtentX = 26882
- _ExtentY = 1032
- ButtonWidth = 820
- ButtonHeight = 979
- Appearance = 1
- Style = 1
- ImageList = "ImageList1"
- _Version = 393216
- BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
- NumButtons = 12
- BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "新增"
- Key = "new"
- ImageKey = "new"
- EndProperty
- BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "修改"
- Key = "modi"
- ImageKey = "xg"
- EndProperty
- BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "删除"
- Key = "del"
- ImageKey = "del"
- EndProperty
- BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "查看"
- Key = "info"
- ImageKey = "info"
- EndProperty
- BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Style = 3
- EndProperty
- BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "新增"
- Key = "news"
- ImageKey = "new"
- EndProperty
- BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "修改"
- Key = "modis"
- ImageKey = "xg"
- EndProperty
- BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "删除"
- Key = "dels"
- ImageKey = "del"
- EndProperty
- BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "查看"
- Key = "infos"
- ImageKey = "info"
- EndProperty
- BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "图标"
- Key = "view"
- ImageKey = "view"
- Style = 5
- BeginProperty ButtonMenus {66833FEC-8583-11D1-B16A-00C0F0283628}
- NumButtonMenus = 5
- BeginProperty ButtonMenu1 {66833FEE-8583-11D1-B16A-00C0F0283628}
- Key = "dtb"
- Text = "大图标"
- EndProperty
- BeginProperty ButtonMenu2 {66833FEE-8583-11D1-B16A-00C0F0283628}
- Key = "xtb"
- Text = "小图标"
- EndProperty
- BeginProperty ButtonMenu3 {66833FEE-8583-11D1-B16A-00C0F0283628}
- Key = "lb"
- Text = "列表"
- EndProperty
- BeginProperty ButtonMenu4 {66833FEE-8583-11D1-B16A-00C0F0283628}
- Key = "xxzl"
- Text = "详细资料"
- EndProperty
- BeginProperty ButtonMenu5 {66833FEE-8583-11D1-B16A-00C0F0283628}
- EndProperty
- EndProperty
- EndProperty
- BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Style = 3
- EndProperty
- BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "关闭"
- Key = "exit"
- ImageKey = "exit"
- EndProperty
- EndProperty
- End
- Begin MSComDlg.CommonDialog dlgCommonDialog
- Left = 13560
- Top = 2040
- _ExtentX = 847
- _ExtentY = 847
- _Version = 393216
- End
- Begin VB.Image imgSplitter
- Height = 4785
- Left = 1965
- MousePointer = 9 'Size W E
- Top = 945
- Width = 150
- End
- End
- Attribute VB_Name = "frmBase"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- '****************************************************************************
- '人人为我,我为人人
- '枕善居收藏整理
- '发布日期:2008/01/21
- '描 述:汽车维修管理系统SQL2000版
- '网 站:http://www.Mndsoft.com/ (VB6源码博客)
- '网 站:http://www.VbDnet.com/ (VB.NET源码博客,主要基于.NET2005)
- 'e-mail :Mndsoft@163.com
- 'e-mail :Mndsoft@126.com
- 'OICQ :88382850
- ' 如果您有新的好的代码别忘记给枕善居哦!
- '****************************************************************************
- Dim mbMoving As Boolean
- Const sglSplitLimit = 500
- Dim strName As String
- Private OK As Boolean '确定用户按了OK还是CANCEL按钮
- Private mvarViewType As gxcViewType '显示类型,即表示当前是添加、查看、修改
- Public Sub AddClientToLvw(ByVal objClient As Recordset, _
- ByRef lvw As ListView, _
- ByVal IsOverWrite As Boolean)
- Dim itm As ListItem
- Dim sIcon As String
- Dim bIcon As String
- If objClient("clkSex") = Male Then
- sIcon = "sboy"
- bIcon = "bboy"
- Else
- sIcon = "sgirl"
- bIcon = "bgirl"
- End If
-
- '如果是更新(即覆盖),则使用当前选种的元素
- If IsOverWrite Then
- Set itm = lvw.SelectedItem
- If itm Is Nothing Then Exit Sub
- Else
- Set itm = lvw.ListItems.Add(, "A" & objClient("clkID"), , bIcon, sIcon)
- End If
- With objClient '这里要与InitClientListview相对应
- itm.SmallIcon = sIcon
- itm.Icon = bIcon
- itm.Text = .Fields(1).Value
- itm.SubItems(1) = IIf(.Fields(3).Value = Male, "男", "女")
- itm.SubItems(2) = GetValueByID("Depart", "DepartId", .Fields(4).Value, "DName")
- itm.SubItems(3) = .Fields(2).Value
- itm.SubItems(4) = .Fields(5).Value
- itm.SubItems(5) = .Fields(6).Value
- End With
- Set itm = Nothing
- End Sub
- '按照“客户”设置ListView的显示样式
- Public Sub InitClientListview(ByRef lvw As ListView)
- With lvw
- .ColumnHeaders.Clear
- '加入四个列首
- .ColumnHeaders.Add , , "姓名", 1200
- .ColumnHeaders.Add , , "性别", 600
- .ColumnHeaders.Add , , "部门", 800
- .ColumnHeaders.Add , , "职务", 1200
- .ColumnHeaders.Add , , "电话", 1300
- .ColumnHeaders.Add , , "入职日期", 1200
- End With
- End Sub
- '将职员显示到ListView中
- Public Sub ClientsToListview(ByVal objClients As Recordset, ByRef lvw As ListView)
- Dim i As Long
-
- If lvw.ColumnHeaders.Count = 0 Then InitClientListview lvw
- lvw.ListItems.Clear '清除当前的列表内容
-
- For i = 1 To objClients.RecordCount
- AddClientToLvw objClients.DataSource, lvw, False
- objClients.MoveNext
- Next i
- End Sub
- ' 显示全部客户到列表控件
- Public Sub ListAllClients(ByRef lvw As ListView)
- Dim rstClients As New Recordset
-
- 'Find的两个参数均取默认值,此时查找全部的客户
- Set rstClients = g_Conn.Execute("select clkid,clkname,clkzw,clksex,clkdepart,clktel,clkindate from Clerk")
-
- '将查找到的客户集合添加到列表控件中
- ClientsToListview rstClients, lvw
-
- Set rstClients = Nothing
-
- End Sub
- Private Sub cmdAddNews_Click()
- frmAddClerk.mvarViewType = vtadd
- frmAddClerk.Show vbModal
- Me.AddClientToLvw g_Conn.Execute("select clkID,clkname,clkzw,clksex,clkdepart,clktel,clkindate from Clerk Where clkID=" & MaxID("Clerk", "clkID")), lvListView, False
- End Sub
- Private Sub cmdDeletes_Click()
- 'If MsgBox("真的要删除“" & lvListView.SelectedItem.Text & "”吗?", vbQuestion + vbYesNo + _
- vbDefaultButton2) = vbNo Then Exit Sub
- 'Dim ErrMsg As String
- 'If RunSql("Delete from clerk where clkID=" & GetID(lvListView.SelectedItem.Key), ErrMsg) Then
- 'Else
- ' MsgBox ErrMsg
- 'End If
- 'lvListView.ListItems.Remove lvListView.SelectedItem.Index
- End Sub
- Private Sub cmdModifys_Click()
- If lvListView.SelectedItem Is Nothing Then Exit Sub
- frmAddClerk.mvarID = lvListView.SelectedItem.Key
- frmAddClerk.mvarViewType = vtModify
- frmAddClerk.Show vbModal
- Me.AddClientToLvw g_Conn.Execute("select clkID,clkname,clkzw,clksex,clkdepart,clktel,clkindate from Clerk Where clkID=" & GetID(lvListView.SelectedItem.Key)), lvListView, True
- End Sub
- Private Sub cmdAddNew_Click()
- strName = Trim(InputBox("请输入部门名称:"))
- If strName = "" Then Exit Sub
- If ExistByName("Depart", "DName", strName) Then
- MsgBox "有重名的部门存在,重新命名!", vbOKOnly + vbExclamation
- Else
- Dim ErrMsg As String
- If RunSql("insert into Depart(Dname) Values('" & strName & "')", ErrMsg) Then
- AddTypeToTvw Me.tvTreeView
- Else
- MsgBox ErrMsg
- End If
- End If
- strName = ""
- End Sub
- Private Sub cmdClose_Click()
- Unload Me
- End Sub
- Private Sub cmdDelete_Click()
- If tvTreeView.SelectedItem.Key = "A0" Then Exit Sub
- If MsgBox("真的要删除“" & tvTreeView.SelectedItem.Text & "”吗?", vbQuestion + vbYesNo + _
- vbDefaultButton2) = vbNo Then Exit Sub
- If ExistByID("Clerk", "clkDepart", GetID(tvTreeView.SelectedItem.Key)) Then MsgBox "此部门下有职员存在!不能删除。": Exit Sub
- Dim ErrMsg As String
- If RunSql("Delete from Depart where DName='" & tvTreeView.SelectedItem.Text & "'", ErrMsg) Then
- tvTreeView.Nodes.Remove (tvTreeView.SelectedItem.Index)
- Else
- MsgBox ErrMsg
- End If
- 'End If
- End Sub
- Private Sub cmdModify_Click()
- If tvTreeView.SelectedItem.Key = "A0" Then Exit Sub
- strName = Trim(InputBox("请输入部门名称:", , tvTreeView.SelectedItem.Text))
- If strName = "" Then Exit Sub
- If ExistByName("Depart", "DName", strName) Then
- MsgBox "有重名的部门存在,重新命名!", vbOKOnly + vbExclamation
- Else
- Dim ErrMsg As String
- If RunSql("Update Depart set Dname='" & strName & "' where DepartId=" & GetID(tvTreeView.SelectedItem.Key), ErrMsg) Then
- tvTreeView.SelectedItem.Text = strName
- Else
- MsgBox ErrMsg
- End If
- End If
- strName = ""
- End Sub
- Private Sub Form_Load()
- InitClientListview lvListView '初始化列表
- ' ListAllClients lvListView
- TypeToTreeview tvTreeView
- End Sub
- Private Sub Form_Resize()
- On Error Resume Next
- If Me.Width < 3000 Then Me.Width = 3000
- SizeControls imgSplitter.Left
- End Sub
- Private Sub imgSplitter_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
- With imgSplitter
- picSplitter.Move .Left, .Top, .Width 2, .Height - 20
- End With
- picSplitter.Visible = True
- mbMoving = True
- End Sub
- Private Sub imgSplitter_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
- Dim sglPos As Single
-
- If mbMoving Then
- sglPos = x + imgSplitter.Left
- If sglPos < sglSplitLimit Then
- picSplitter.Left = sglSplitLimit
- ElseIf sglPos > Me.Width - sglSplitLimit Then
- picSplitter.Left = Me.Width - sglSplitLimit
- Else
- picSplitter.Left = sglPos
- End If
- End If
- End Sub
- Private Sub imgSplitter_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
- SizeControls picSplitter.Left
- picSplitter.Visible = False
- mbMoving = False
- End Sub
- Private Sub TreeView1_DragDrop(Source As Control, x As Single, y As Single)
- If Source = imgSplitter Then
- SizeControls x
- End If
- End Sub
- Sub SizeControls(x As Single)
- On Error Resume Next
-
- '设置 Width 属性
- If x < 1500 Then x = 1500
- If x > (Me.Width - 1500) Then x = Me.Width - 1500
- tvTreeView.Width = x
- imgSplitter.Left = x
- lvListView.Left = x + 40
- lvListView.Width = Me.Width - (tvTreeView.Width + 140)
- lblTitle(0).Width = tvTreeView.Width
- lblTitle(1).Left = lvListView.Left + 20
- lblTitle(1).Width = lvListView.Width - 40
- '设置 Top 属性
-
- If ToolBartb.Visible Then
- tvTreeView.Top = ToolBartb.Height + picTitles.Height
- Else
- tvTreeView.Top = picTitles.Height
- End If
- lvListView.Top = tvTreeView.Top
-
- '设置 height 属性
- tvTreeView.Height = Me.ScaleHeight - (picTitles.Top + picTitles.Height)
- lvListView.Height = tvTreeView.Height
- imgSplitter.Top = tvTreeView.Top
- imgSplitter.Height = tvTreeView.Height
- End Sub
- Public Sub TypeToTreeview(ByRef tvw As TreeView)
- Dim i As Long
- Dim Nd As Node
- Dim Rs As Recordset
- Set Nd = tvw.Nodes.Add(, , "A0", "所有部门", "A0")
-
- Nd.Expanded = True
- Nd.Selected = True
- Set Rs = g_Conn.Execute("select DepartId,DName from Depart")
- For i = 1 To Rs.RecordCount
- Set Nd = tvw.Nodes.Add("A0", tvwChild, "A" & Rs(0), Rs(1), "A1")
- Nd.Expanded = True
- '加载其下级客户类型节点
- ' LoadSubNodes tvw, Nd, super.ID
- Rs.MoveNext
- Next i
- End Sub
- Public Sub AddTypeToTvw(ByRef tvw As TreeView)
- On Error Resume Next
- tvw.Nodes.Add "A0", tvwChild, "A" & MaxID("Depart", "DepartId"), strName, "A1"
- End Sub
- Private Sub lvListView_DblClick()
- If lvListView.SelectedItem Is Nothing Then Exit Sub
- frmAddClerk.mvarID = lvListView.SelectedItem.Key
- frmAddClerk.mvarViewType = vtinfo
- frmAddClerk.Show vbModal
- End Sub
- Private Sub ToolBartb_ButtonClick(ByVal Button As MSComctlLib.Button)
- Select Case Button.Key
- Case "new"
- If g_QX(0) Then cmdAddNew_Click Else MsgBox qMSG
- Case "modi"
- If g_QX(0) Then cmdModify_Click Else MsgBox qMSG
- Case "del"
- If g_QX(0) Then cmdDelete_Click Else MsgBox qMSG
- Case "exit"
- cmdClose_Click
- Case "news"
- If g_QX(1) Then cmdAddNews_Click Else MsgBox qMSG
- Case "modis"
- If g_QX(1) Then cmdModifys_Click Else MsgBox qMSG
- Case "dels"
- If g_QX(1) Then cmdDeletes_Click Else MsgBox qMSG
- Case "infos"
- lvListView_DblClick
- Case "view"
- If lvListView.View = lvwIcon Then
- lvListView.View = lvwSmallIcon
- ElseIf lvListView.View = lvwSmallIcon Then
- lvListView.View = lvwList
- ElseIf lvListView.View = lvwList Then
- lvListView.View = lvwReport
- ElseIf lvListView.View = lvwReport Then
- lvListView.View = lvwIcon
- End If
- End Select
- End Sub
- Private Sub ToolBartb_ButtonMenuClick(ByVal ButtonMenu As MSComctlLib.ButtonMenu)
- Select Case ButtonMenu.Key
- Case "dtb"
- lvListView.View = lvwIcon
- Case "xtb"
- lvListView.View = lvwSmallIcon
- Case "lb"
- lvListView.View = lvwList
- Case "xxzl"
- lvListView.View = lvwReport
- End Select
- End Sub
- Private Sub tvTreeView_NodeClick(ByVal Node As MSComctlLib.Node)
- Dim khID As String
- khID = GetID(Me.tvTreeView.SelectedItem.Key)
- Dim Rst As New ADODB.Recordset
- If khID = 0 Then
- Set Rst = g_Conn.Execute("select clkid,clkname,clkzw,clksex,clkdepart,clktel,clkindate from Clerk")
- Else
- Set Rst = g_Conn.Execute("select clkid,clkname,clkzw,clksex,clkdepart,clktel,clkindate from Clerk where clkdepart=" & khID)
- End If
- ClientsToListview Rst, lvListView
- End Sub