📄 frm文件表.frm
字号:
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"
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
Begin VB.Form frm文件表
BorderStyle = 3 'Fixed Dialog
Caption = "文件表"
ClientHeight = 7305
ClientLeft = 1095
ClientTop = 330
ClientWidth = 9600
KeyPreview = -1 'True
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 7305
ScaleWidth = 9600
Begin TabDlg.SSTab SSTab1
Height = 7140
Left = 150
TabIndex = 0
Top = 75
Width = 9390
_ExtentX = 16563
_ExtentY = 12594
_Version = 393216
Style = 1
Tabs = 2
TabsPerRow = 2
TabHeight = 520
TabCaption(0) = "文件登记"
TabPicture(0) = "frm文件表.frx":0000
Tab(0).ControlEnabled= -1 'True
Tab(0).Control(0)= "OLE1"
Tab(0).Control(0).Enabled= 0 'False
Tab(0).Control(1)= "lblLabels(5)"
Tab(0).Control(1).Enabled= 0 'False
Tab(0).Control(2)= "lblLabels(4)"
Tab(0).Control(2).Enabled= 0 'False
Tab(0).Control(3)= "lblLabels(3)"
Tab(0).Control(3).Enabled= 0 'False
Tab(0).Control(4)= "lblLabels(2)"
Tab(0).Control(4).Enabled= 0 'False
Tab(0).Control(5)= "lblLabels(1)"
Tab(0).Control(5).Enabled= 0 'False
Tab(0).Control(6)= "lblLabels(0)"
Tab(0).Control(6).Enabled= 0 'False
Tab(0).Control(7)= "dlgOpen"
Tab(0).Control(7).Enabled= 0 'False
Tab(0).Control(8)= "Data1"
Tab(0).Control(8).Enabled= 0 'False
Tab(0).Control(9)= "cmdOpen"
Tab(0).Control(9).Enabled= 0 'False
Tab(0).Control(10)= "Combo1"
Tab(0).Control(10).Enabled= 0 'False
Tab(0).Control(11)= "datPrimaryRS"
Tab(0).Control(11).Enabled= 0 'False
Tab(0).Control(12)= "picButtons"
Tab(0).Control(12).Enabled= 0 'False
Tab(0).Control(13)= "txtFields(5)"
Tab(0).Control(13).Enabled= 0 'False
Tab(0).Control(14)= "txtFields(3)"
Tab(0).Control(14).Enabled= 0 'False
Tab(0).Control(15)= "txtFields(2)"
Tab(0).Control(15).Enabled= 0 'False
Tab(0).Control(16)= "txtFields(1)"
Tab(0).Control(16).Enabled= 0 'False
Tab(0).Control(17)= "txtFields(0)"
Tab(0).Control(17).Enabled= 0 'False
Tab(0).Control(18)= "Command1"
Tab(0).Control(18).Enabled= 0 'False
Tab(0).ControlCount= 19
TabCaption(1) = "文件清单"
TabPicture(1) = "frm文件表.frx":001C
Tab(1).ControlEnabled= 0 'False
Tab(1).Control(0)= "ListView1"
Tab(1).ControlCount= 1
Begin VB.CommandButton Command1
Caption = "新类别"
Height = 285
Left = 5490
TabIndex = 22
Top = 855
Width = 780
End
Begin MSComctlLib.ListView ListView1
Height = 6540
Left = -74850
TabIndex = 21
Top = 450
Width = 9090
_ExtentX = 16034
_ExtentY = 11536
LabelEdit = 1
LabelWrap = -1 'True
HideSelection = -1 'True
GridLines = -1 'True
_Version = 393217
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
NumItems = 0
End
Begin VB.TextBox txtFields
DataField = "文件编号"
DataSource = "datPrimaryRS"
Height = 285
Index = 0
Left = 2040
TabIndex = 13
Top = 525
Width = 3375
End
Begin VB.TextBox txtFields
DataField = "文件类别"
DataSource = "datPrimaryRS"
Height = 285
Index = 1
Left = 2040
TabIndex = 12
Top = 840
Width = 1575
End
Begin VB.TextBox txtFields
DataField = "文件主题"
DataSource = "datPrimaryRS"
Height = 285
Index = 2
Left = 2040
TabIndex = 11
Top = 1170
Width = 7125
End
Begin VB.TextBox txtFields
DataField = "文件说明"
DataSource = "datPrimaryRS"
Height = 285
Index = 3
Left = 2040
TabIndex = 10
Top = 1485
Width = 7125
End
Begin VB.TextBox txtFields
DataField = "当前版本"
DataSource = "datPrimaryRS"
Height = 285
Index = 5
Left = 2040
TabIndex = 9
Top = 5955
Width = 3375
End
Begin VB.PictureBox picButtons
Appearance = 0 'Flat
BorderStyle = 0 'None
ForeColor = &H80000008&
Height = 300
Left = 3450
ScaleHeight = 300
ScaleWidth = 5835
TabIndex = 3
Top = 6375
Width = 5835
Begin VB.CommandButton cmdAdd
Caption = "添加(&A)"
Height = 300
Left = 59
TabIndex = 8
Top = 0
Width = 1095
End
Begin VB.CommandButton cmdUpdate
Caption = "更新(&U)"
Height = 300
Left = 1213
TabIndex = 7
Top = 0
Width = 1095
End
Begin VB.CommandButton cmdDelete
Caption = "删除(&D)"
Height = 300
Left = 2367
TabIndex = 6
Top = 0
Width = 1095
End
Begin VB.CommandButton cmdRefresh
Caption = "刷新(&R)"
Height = 300
Left = 3521
TabIndex = 5
Top = 0
Width = 1095
End
Begin VB.CommandButton cmdClose
Caption = "关闭(&C)"
Height = 300
Left = 4675
TabIndex = 4
Top = 0
Width = 1095
End
End
Begin VB.Data datPrimaryRS
Connect = "Access"
DatabaseName = "D:\MyProducts\Programs\Manager\Manager.mdb"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 345
Left = 75
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "文件表"
Top = 6660
Width = 9210
End
Begin VB.ComboBox Combo1
Height = 300
ItemData = "frm文件表.frx":0038
Left = 3675
List = "frm文件表.frx":003A
TabIndex = 2
Top = 840
Width = 1740
End
Begin VB.CommandButton cmdOpen
Caption = "..."
Height = 315
Left = 5025
TabIndex = 1
Top = 1815
Width = 465
End
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 = 2175
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "类别表"
Top = 1890
Visible = 0 'False
Width = 2040
End
Begin MSComDlg.CommonDialog dlgOpen
Left = 4725
Top = 2940
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.Label lblLabels
Caption = "文件编号:"
Height = 255
Index = 0
Left = 120
TabIndex = 20
Top = 525
Width = 1815
End
Begin VB.Label lblLabels
Caption = "文件类别:"
Height = 255
Index = 1
Left = 120
TabIndex = 19
Top = 840
Width = 1815
End
Begin VB.Label lblLabels
Caption = "文件主题:"
Height = 255
Index = 2
Left = 120
TabIndex = 18
Top = 1170
Width = 1815
End
Begin VB.Label lblLabels
Caption = "文件说明:"
Height = 255
Index = 3
Left = 120
TabIndex = 17
Top = 1485
Width = 1815
End
Begin VB.Label lblLabels
Caption = "文件内容:"
Height = 255
Index = 4
Left = 120
TabIndex = 16
Top = 1800
Width = 1815
End
Begin VB.Label lblLabels
Caption = "当前版本:"
Height = 255
Index = 5
Left = 120
TabIndex = 15
Top = 5955
Width = 1815
End
Begin VB.OLE OLE1
DataField = "文件内容"
DataSource = "datPrimaryRS"
Height = 3615
Left = 150
TabIndex = 14
Top = 2190
Width = 9015
End
End
End
Attribute VB_Name = "frm文件表"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdOpen_Click()
With dlgOpen
.ShowOpen
.DialogTitle = "选择文件"
End With
If dlgOpen.FileName = "" Then
Exit Sub
Else
OLE1.CreateEmbed dlgOpen.FileName
OLE1.Update
MsgBox "文件加载完毕!", vbOKOnly, "提示"
End If
End Sub
Private Sub Combo1_Click()
txtFields(1).Text = Combo1.Text
End Sub
Private Sub Command1_Click()
Manager.frm类别表.Show vbModal
End Sub
Private Sub datPrimaryRS_Error(DataErr As Integer, Response As Integer)
'错误处理程序代码置于此处
'想要忽略错误,注释掉下一行
'想要捕获它们,在此添加代码以处理它们
MsgBox "Data error event hit err:" & Description
End Sub
Private Sub Form_Initialize()
Data1.RecordSource = "select DISTINCT 文件类别 from 类别表"
Data1.Refresh
Do Until Data1.Recordset.EOF
Combo1.AddItem Data1.Recordset.Fields("文件类别").Value
Data1.Recordset.MoveNext
Loop
FillList
End Sub
Function FillList()
Dim item As ListItem
ListView1.ColumnHeaders.Clear
ListView1.ColumnHeaders.Add , , "文件编号"
ListView1.ColumnHeaders.Add , , "文件类别"
ListView1.ColumnHeaders.Add , , "文件主题"
ListView1.ColumnHeaders.Add , , "文件说明"
ListView1.ColumnHeaders.Add , , "当前版本"
ListView1.ListItems.Clear
ListView1.View = lvwReport
Data1.RecordSource = "select * from 文件表"
Data1.Refresh
Do Until Data1.Recordset.EOF
Set item = ListView1.ListItems.Add(, , Data1.Recordset.Fields("文件编号").Value)
item.ListSubItems.Add , , Data1.Recordset.Fields("文件类别").Value
item.ListSubItems.Add , , Data1.Recordset.Fields("文件主题").Value
item.ListSubItems.Add , , Data1.Recordset.Fields("文件说明").Value
item.ListSubItems.Add , , Data1.Recordset.Fields("当前版本").Value
Data1.Recordset.MoveNext
Loop
Data1.Recordset.Close
End Function
Private Sub Form_Load()
Data1.DatabaseName = conn
datPrimaryRS.DatabaseName = conn
End Sub
Private Sub Form_Unload(Cancel As Integer)
Screen.MousePointer = vbDefault
End Sub
Private Sub cmdAdd_Click()
On Error GoTo AddErr
datPrimaryRS.Recordset.AddNew
Exit Sub
AddErr:
MsgBox Err.Description
End Sub
Private Sub cmdDelete_Click()
On Error GoTo DeleteErr
With datPrimaryRS.Recordset
.Delete
.MoveNext
If .EOF Then .MoveLast
End With
Exit Sub
DeleteErr:
MsgBox Err.Description
End Sub
Private Sub cmdRefresh_Click()
'只有多用户应用程序需要
On Error GoTo RefreshErr
datPrimaryRS.Refresh
Exit Sub
RefreshErr:
MsgBox Err.Description
End Sub
Private Sub cmdUpdate_Click()
On Error GoTo UpdateErr
datPrimaryRS.Recordset.MoveNext
datPrimaryRS.Recordset.MovePrevious
Exit Sub
UpdateErr:
MsgBox Err.Description
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -