📄 frmopen.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmOpen
BorderStyle = 3 'Fixed Dialog
Caption = "打开"
ClientHeight = 5355
ClientLeft = 2040
ClientTop = 1950
ClientWidth = 8070
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5355
ScaleWidth = 8070
ShowInTaskbar = 0 'False
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = "D:\MyProducts\Programs\Manager\Manager.mdb"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 345
Left = -450
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "类别表"
Top = 4050
Visible = 0 'False
Width = 2490
End
Begin VB.CommandButton CancelButton
Caption = "取消"
Height = 375
Left = 6675
TabIndex = 1
Top = 4800
Width = 1215
End
Begin VB.CommandButton OKButton
Caption = "确定"
Height = 375
Left = 4725
TabIndex = 0
Top = 4800
Width = 1215
End
Begin MSComctlLib.ImageList ImageList2
Left = 3150
Top = 2295
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 32
ImageHeight = 32
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 2
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmOpen.frx":0000
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmOpen.frx":0452
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.ImageList ImageList1
Left = 525
Top = 1320
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 16
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 2
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmOpen.frx":08A4
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmOpen.frx":0CF6
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.ListView lvListView
Height = 4425
Left = 2055
TabIndex = 2
Top = 0
Width = 3360
_ExtentX = 5927
_ExtentY = 7805
Arrange = 2
LabelEdit = 1
LabelWrap = -1 'True
HideSelection = -1 'True
_Version = 393217
Icons = "ImageList2"
SmallIcons = "ImageList1"
ColHdrIcons = "ImageList1"
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
NumItems = 0
End
Begin MSComctlLib.TreeView tvwC
Height = 4425
Left = 0
TabIndex = 3
Top = 0
Width = 2010
_ExtentX = 3545
_ExtentY = 7805
_Version = 393217
Indentation = 529
Style = 7
ImageList = "ImageList1"
Appearance = 1
End
Begin VB.Label Label1
BackColor = &H00FFFFC0&
BorderStyle = 1 'Fixed Single
Caption = "Label1"
Height = 1815
Left = 5550
TabIndex = 5
Top = 45
Width = 2415
End
Begin VB.OLE OLE1
BackColor = &H80000018&
DataSource = "Data1"
Height = 2565
Left = 5550
TabIndex = 4
Top = 1875
Width = 2415
End
End
Attribute VB_Name = "frmOpen"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub CancelButton_Click()
Unload Me
End Sub
Private Sub Form_Load()
Data1.DatabaseName = conn
tvwCRefresh
End Sub
Private Sub lvListView_ItemClick(ByVal item As MSComctlLib.ListItem)
Dim temps As String
temps = Data1.RecordSource
Data1.RecordSource = "select * from 我的表 where 文件编号 = " & item.Tag
Data1.Refresh
Label1.Caption = Data1.Recordset.Fields("文件说明").Value
OLE1.DataField = "文件内容"
OLE1.SizeMode = 1
OLE1.Update
Data1.Recordset.Close
Data1.RecordSource = temps
End Sub
Private Sub tvwCRefresh()
Dim rootNode As Node, nd As Node
On Error Resume Next
Data1.RecordSource = "类别表"
Data1.Refresh
' Open the Authors recordset.
If Err Then
MsgBox "Unable to open aaa table" & Err.Description, vbCritical
End
End If
' Add the "Publishers" root (expanded).
Set rootNode = tvwC.Nodes.Add(, , "\\Type", "职位文件", 1)
rootNode.Expanded = True
' Add all the publishers, with a plus sign.
Do Until Data1.Recordset.EOF
Set nd = tvwC.Nodes.Add(rootNode.Key, tvwChild, , Data1.Recordset.Fields("适合职位").Value, 1)
' We can't use PubID as the Key, because it is a number.
nd.Tag = Data1.Recordset.Fields("适合职位").Value
AddDummyChild nd
Data1.Recordset.MoveNext
Loop
Data1.Recordset.Close
End Sub
Sub AddDummyChild(nd As Node)
' add a dummy child node, if necessary
If nd.Children = 0 Then
' dummy nodes' Text property is "***"
tvwC.Nodes.Add nd.Index, tvwChild, , "***"
End If
End Sub
Private Sub OKButton_Click()
OLE1.Verb
End Sub
Private Sub tvwC_Expand(ByVal Node As MSComctlLib.Node)
' a node if being expanded
Dim nd As Node
' exit if the node had been already expanded in the past
If Node.Children = 0 Or Node.Children > 1 Then Exit Sub
' also exit if it doesn't have a dummy child node
If Node.Child.Text <> "***" Then Exit Sub
' remove the dummy child item
tvwC.Nodes.Remove Node.Child.Index
' add all the titles for this Node object
AddTitles Node
End Sub
Private Sub AddTitles(ByVal Node As MSComctlLib.Node)
Dim nd As Node
Data1.RecordSource = "select * from 类别表 where trim(适合职位) = '" & Trim(Node.Tag) & "'"
Data1.Refresh
Do Until Data1.Recordset.EOF
Set nd = tvwC.Nodes.Add(Node, tvwChild, , Data1.Recordset.Fields("文件类别").Value, 1)
nd.Tag = Data1.Recordset.Fields("文件类别").Value
Data1.Recordset.MoveNext
Loop
Data1.Recordset.Close
End Sub
Private Sub tvwC_NodeClick(ByVal Node As MSComctlLib.Node)
Dim temps As String
Dim item As ListItem
temps = Data1.RecordSource
Data1.RecordSource = "select * from 我的表 " & " where 文件类别 = '" & Node.Tag & " '"
Data1.Refresh
lvListView.ListItems.Clear
Do Until Data1.Recordset.EOF
Set item = lvListView.ListItems.Add(, , Data1.Recordset.Fields("文件主题").Value, 2)
item.Tag = Data1.Recordset.Fields("文件编号").Value
Data1.Recordset.MoveNext
Loop
Data1.Recordset.Close
Data1.RecordSource = temps
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -