📄 productypelistform.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Object = "{0ECD9B60-23AA-11D0-B351-00A0C9055D8E}#6.0#0"; "MSHFLXGD.OCX"
Begin VB.Form productypelistform
Caption = "Form1"
ClientHeight = 5010
ClientLeft = 60
ClientTop = 450
ClientWidth = 6525
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 5010
ScaleWidth = 6525
Begin MSComctlLib.Toolbar SzToolbar
Align = 1 'Align Top
Height = 570
Left = 0
TabIndex = 0
Top = 0
Width = 6525
_ExtentX = 11509
_ExtentY = 1005
ButtonWidth = 820
ButtonHeight = 953
AllowCustomize = 0 'False
Appearance = 1
Style = 1
ImageList = "ImageList1"
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 9
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "新增"
Key = "xz"
ImageKey = "xz"
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "修改"
Key = "xg"
ImageKey = "xg"
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "删除"
Key = "sc"
ImageKey = "sc"
EndProperty
BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
Object.Visible = 0 'False
EndProperty
BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "查询"
Key = "cx"
ImageKey = "cx"
EndProperty
BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "刷新"
Key = "sx"
ImageKey = "sx"
EndProperty
BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}
Object.Visible = 0 'False
Style = 3
EndProperty
BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "退出"
Key = "tc"
ImageKey = "tc"
EndProperty
EndProperty
BorderStyle = 1
Begin VB.TextBox Text1
Alignment = 1 'Right Justify
Appearance = 0 'Flat
ForeColor = &H80000006&
Height = 270
Left = 5040
TabIndex = 2
Text = "Text1"
Top = 120
Width = 975
End
Begin MSComctlLib.ImageList ImageList1
Left = 5880
Top = 0
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 16
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 7
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "productypelistform.frx":0000
Key = "dy"
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "productypelistform.frx":039A
Key = "xg"
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "productypelistform.frx":0734
Key = "tc"
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "productypelistform.frx":0ACE
Key = "xz"
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "productypelistform.frx":0E68
Key = "sc"
EndProperty
BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "productypelistform.frx":1202
Key = "sx"
EndProperty
BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "productypelistform.frx":159C
Key = "cx"
EndProperty
EndProperty
End
End
Begin MSHierarchicalFlexGridLib.MSHFlexGrid hfg_houseList
Height = 4455
Left = 0
TabIndex = 1
Top = 600
Width = 6495
_ExtentX = 11456
_ExtentY = 7858
_Version = 393216
BackColor = -2147483634
Cols = 4
FixedCols = 0
RowHeightMin = 300
BackColorFixed = 15723503
AllowUserResizing= 3
_NumberOfBands = 1
_Band(0).Cols = 4
End
End
Attribute VB_Name = "productypelistform"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'**************************************
'* 模 块 名 称 :产品类别设置用户操作界面
'* 功 能 描 述 :产品类别设置用户操作界面
'* 程序员姓名 : 石春晓
'* 最后修改人 : 石春晓
'* 最后修改时间:2005/09/06
'**************************************
Option Explicit
Private m_productypeDAO As productypeDAO ' 产品类别数据库操作类
Private m_recordset As ADODB.Recordset ' 数据操作数据集对象
Private q As Integer
Private m_idList As String ' 在执行查询时查询到的ID列表字符串
'**************************************
'* 功 能 描 述 :窗体加载函数
'* 输 入 参 数 :无
'* 输 出 能 数 :无
'**************************************
Private Sub Form_Load()
Set m_productypeDAO = New productypeDAO
Set m_recordset = New ADODB.Recordset
Me.caption = "产品类别设置"
RefreshListTitle
refreshlist
Me.Height = 5520
Me.Width = 6645
SetToCenter Me
End Sub
Private Sub Form_Resize()
hfg_houseList.Height = Me.Height - 1400
hfg_houseList.Width = Me.Width - 350
' Image1.Stretch = False
If (hfg_houseList.Height > hfg_houseList.Height - 300) Or (hfg_houseList.Width > hfg_houseList.Width - 200) Then
hfg_houseList.Height = hfg_houseList.Height + 400
hfg_houseList.Width = hfg_houseList.Width + 200
'
' Image1.Stretch = True
End If
End Sub
Private Sub hfg_houseList_DblClick()
' 修改
productypesingleform.m_operatorType = 1
If Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 0)) <> "" Then
productypesingleform.m_productypeid = Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 0))
productypesingleform.show 1
If q = 1 Then
RefreshQueryList
Else
refreshlist
End If
End If
End Sub
'**************************************
'* 功 能 描 述 :工具栏按钮的单击操作按钮
'* 输 入 参 数 :无
'* 输 出 能 数 :无
'**************************************
Private Sub SzToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Key
Case "xz" ' 新增
productypesingleform.m_operatorType = 0
productypesingleform.show 1
refreshlist
Case "xg" ' 修改
productypesingleform.m_operatorType = 1
If Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 0)) <> "" Then
productypesingleform.m_productypeid = Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 0))
productypesingleform.show 1
If q = 1 Then
RefreshQueryList
Else
refreshlist
End If
End If
Case "sc" ' 删除
Call delete
Call refreshlist
Case "cx" ' 查询
Call Query
Case "sx" '刷 新
q = 0
Call refreshlist
Case "tc" '退 出
Unload Me
End Select
End Sub
'**************************************
'* 功 能 描 述 :刷新仓库列表
'* 输 入 参 数 :无
'* 输 出 能 数 :无
'**************************************
Private Sub refreshlist()
Dim currentrow As Integer ' 当前插入的行
m_productypeDAO.FindAll m_recordset
' Set hfg_houseList.DataSource = m_recordset ' 数据源绑定到显示控件
hfg_houseList.clear
hfg_houseList.Rows = 2
RefreshListTitle
With m_recordset
' hfg_houseList.Rows = m_recordset.RecordCount
currentrow = 1
Do While Not .EOF
If currentrow > hfg_houseList.Rows - 1 Then
hfg_houseList.AddItem ""
End If
'[>>自定义填充内容
hfg_houseList.TextMatrix(currentrow, 0) = Trim(.Fields("产品类别ID"))
hfg_houseList.TextMatrix(currentrow, 1) = Trim(.Fields("产品序号"))
hfg_houseList.TextMatrix(currentrow, 2) = Trim(.Fields("产品类别名称"))
hfg_houseList.TextMatrix(currentrow, 3) = Trim(.Fields("备注"))
'<<]
'设置数据行高度(Fixed)
hfg_houseList.RowHeight(currentrow) = 200
'动态集指针加1,同时将计数器加1(Fixed)
.MoveNext
currentrow = currentrow + 1
Loop
End With
Text1.text = Trim(m_recordset.RecordCount)
m_recordset.Close
End Sub
'**************************************
'* 功 能 描 述 :删除一条记录
'* 输 入 参 数 :无
'* 输 出 能 数 :无
'**************************************
Private Sub delete()
If Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 0)) = "" Then
MainForm.g_msgText = "请选择一条记录!"
HMsgBox MainForm.g_msgText, 0, 1
End If
MainForm.g_msgText = "确定删除这条记录吗?"
Dim f As String
f = HMsgBox(MainForm.g_msgText, 2, 2)
If f = 1 Then
m_productypeDAO.DeleteById m_recordset, _
Trim(hfg_houseList.TextMatrix(hfg_houseList.row, 0))
End If
End Sub
'**************************************
'* 功 能 描 述 :刷新列表的标题栏
'* 输 入 参 数 :无
'* 输 出 能 数 :无
'**************************************
Private Sub RefreshListTitle()
hfg_houseList.TextMatrix(0, 0) = "产品类别ID"
hfg_houseList.TextMatrix(0, 1) = "序号"
hfg_houseList.TextMatrix(0, 2) = "产品类别名称"
hfg_houseList.TextMatrix(0, 3) = "备注"
'设置列对齐方式 8-右对齐 5-居中对齐 2-左对齐
hfg_houseList.ColAlignment(0) = 2
hfg_houseList.ColAlignment(1) = 8
hfg_houseList.ColAlignment(2) = 2
hfg_houseList.ColAlignment(3) = 2
hfg_houseList.ColWidth(0) = 1
End Sub
'**************************************
'* 功 能 描 述 :查询记录
'* 输 入 参 数 :无
'* 输 出 能 数 :无
'**************************************
Private Sub Query()
q = 1
QueryFom.m_currentQuery = QUERY_PRODUCTYPE
QueryFom.m_operateType = 1
QueryFom.show vbModal
m_idList = MainForm.g_application.m_queryResultId
RefreshQueryList ' 显示查询到的结果
End Sub
Private Sub RefreshQueryList()
Dim ret As Boolean
' 显示查询到的结果
On Error GoTo EXITFUN
MainForm.g_application.m_databaseCon.m_adoConnection.BeginTrans ' 开始事务
InsertQueryIdList m_idList ' 把要显示的记录ID列表插入临时表
ret = m_productypeDAO.productype_findByldList(m_recordset) ' 查找记录
MainForm.g_application.m_databaseCon.m_adoConnection.CommitTrans ' 提交事务
hfg_houseList.clear
hfg_houseList.Rows = 2
RefreshListTitle
If ret Then
GetRecordToList m_recordset
End If
Text1.text = Trim(m_recordset.RecordCount)
m_recordset.Close
Exit Sub
EXITFUN:
MainForm.g_application.m_databaseCon.m_adoConnection.RollbackTrans ' 回滚事务
End Sub
'**************************************
'* 功 能 描 述 :从数据集中取出记录在列表中显示
'* 输 入 参 数 :无
'* 输 出 能 数 :无
'**************************************
Private Sub GetRecordToList(recSet As ADODB.Recordset)
Dim currentrow As Integer
With m_recordset
' hfg_houseList.Rows = m_recordset.RecordCount
currentrow = 1
Do While Not .EOF
If currentrow > hfg_houseList.Rows - 1 Then
hfg_houseList.AddItem ""
End If
'[>>自定义填充内容
hfg_houseList.TextMatrix(currentrow, 0) = Trim(.Fields("产品类别ID"))
hfg_houseList.TextMatrix(currentrow, 1) = Trim(.Fields("产品序号"))
hfg_houseList.TextMatrix(currentrow, 2) = Trim(.Fields("产品类别名称"))
hfg_houseList.TextMatrix(currentrow, 3) = Trim(.Fields("备注"))
'<<]
'设置数据行高度(Fixed)
hfg_houseList.RowHeight(currentrow) = 300
'动态集指针加1,同时将计数器加1(Fixed)
.MoveNext
currentrow = currentrow + 1
Loop
End With
Text1.text = Trim(m_recordset.RecordCount)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -