📄 frmmerchandiseinfo.frm
字号:
VERSION 5.00
Begin VB.Form frmMerchandiseinfo
BorderStyle = 1 'Fixed Single
Caption = "商品信息"
ClientHeight = 3195
ClientLeft = 45
ClientTop = 330
ClientWidth = 4200
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3195
ScaleWidth = 4200
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton cmdCancle
Caption = "放弃"
Height = 375
Left = 2513
TabIndex = 7
Top = 2640
Width = 975
End
Begin VB.CommandButton cmdOK
Caption = "确认"
Height = 375
Left = 713
TabIndex = 6
Top = 2640
Width = 975
End
Begin VB.ComboBox cmbKind
Height = 300
Left = 960
Style = 2 'Dropdown List
TabIndex = 5
Top = 600
Width = 2895
End
Begin VB.TextBox txtMerchandiseName
Height = 270
Left = 960
TabIndex = 4
Text = "txtMerchandiseName"
Top = 240
Width = 2895
End
Begin VB.Frame Frame1
Caption = "备注"
Height = 1215
Left = 240
TabIndex = 2
Top = 960
Width = 3735
Begin VB.TextBox txtRemark
Height = 855
Left = 120
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 3
Text = "frmMerchandiseinfo.frx":0000
Top = 240
Width = 3495
End
End
Begin VB.Label lblErrorInfo
Caption = "lblErrorInfo"
ForeColor = &H000000FF&
Height = 375
Left = 240
TabIndex = 8
Top = 2280
Width = 3735
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "商品类别"
Height = 180
Left = 120
TabIndex = 1
Top = 660
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "商品名"
Height = 180
Left = 120
TabIndex = 0
Top = 285
Width = 540
End
End
Attribute VB_Name = "frmMerchandiseinfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private m_OpModiFlag As Boolean '修改操作标志
Private m_Merchandise As clsMerchandiseinfo '当前商品
Private m_CurrentUser As clsOpuser '当前操作用户
'***********************************************************************
'* 过程名:IniComboxKind
'* 功 能:初始化商品类别下拉框
'* 参 数:
'* 版 本:2006.01.03 颜志军 初版
'***********************************************************************
Private Sub IniComboxKind()
'变量定义
Dim kindList As clsMerchandisekindSet '商品类别集合
Dim singleKind As clsMerchandisekind '商品类别
Dim index As Integer '索引
'生成类别集合
Set kindList = New clsMerchandisekindSet
'初始化COMBOX列表
index = 0
For Each singleKind In kindList
cmbKind.AddItem singleKind.kindName, index
cmbKind.ItemData(index) = singleKind.kindId
index = index + 1
Next
'初始化显示项
If cmbKind.ListCount > 0 Then
cmbKind.ListIndex = 0
End If
End Sub
'***********************************************************************
'* 过程名:DspMerchandiseInfo
'* 功 能:显示商品信息
'* 参 数:
'* 版 本:2006.01.03 颜志军 初版
'***********************************************************************
Private Sub DspMerchandiseInfo()
'清空错误信息显示标签
lblErrorInfo.Caption = ""
'商品类型下拉框
IniComboxKind
'其它控件显示设定
If m_OpModiFlag Then '修改
txtMerchandiseName.Text = m_Merchandise.merchandiseName
txtRemark.Text = m_Merchandise.remark
cmbKind.Text = m_Merchandise.kindName
Else '新增
txtMerchandiseName.Text = ""
txtRemark.Text = ""
End If
End Sub
'***********************************************************************
'* 函数名:CheckInput
'* 功 能:检查输入信息
'* 参 数:
'* 返回值:Boolean True 通过 False 未通过
'* 版 本:2006.01.03 颜志军 初版
'***********************************************************************
Private Function CheckInput() As Boolean
If IsEmpty(Trim(txtMerchandiseName.Text)) Or Trim(txtMerchandiseName.Text) = "" Then
lblErrorInfo.Caption = "必须输入商品名!"
CheckInput = False
ElseIf IsEmpty(Trim(cmbKind.Text)) Or Trim(cmbKind.Text) = "" Then
lblErrorInfo.Caption = "必须选择商品类别!"
CheckInput = False
Else
CheckInput = True
End If
End Function
'***********************************************************************
'* 函数名:UpdateObject
'* 功 能:更新设定信息到对象
'* 参 数:
'* 返回值:Boolean
'* 版 本:2006.01.03 颜志军 初版
'***********************************************************************
Private Function UpdateObject() As Boolean
If CheckInput() Then
m_Merchandise.merchandiseName = Trim(txtMerchandiseName.Text)
m_Merchandise.kindId = cmbKind.ItemData(cmbKind.ListIndex)
m_Merchandise.remark = Trim(txtRemark.Text)
UpdateObject = True
Else
UpdateObject = False
End If
End Function
'***********************************************************************
'* 过程名:ShowDlg
'* 功 能:显示对话框
'* 参 数:
'* 版 本:2006.01.03 颜志军 初版
'***********************************************************************
Public Sub ShowDlg(ByRef curMerchandise As clsMerchandiseinfo, _
ByVal opFlag As Boolean, _
ByVal currentUser As clsOpuser)
Set m_Merchandise = curMerchandise
Set m_CurrentUser = currentUser
m_OpModiFlag = opFlag
DspMerchandiseInfo
Me.Show vbModal
End Sub
'***********************************************************************
'* 过程名:cmdCancle_Click
'* 功 能:放弃按钮按下事件响应
'* 参 数:
'* 版 本:2006.01.03 颜志军 初版
'***********************************************************************
Private Sub cmdCancle_Click()
Unload Me
End Sub
'***********************************************************************
'* 过程名:cmdOK_Click
'* 功 能:确认按钮按下事件响应
'* 参 数:
'* 版 本:2006.01.03 颜志军 初版
'***********************************************************************
Private Sub cmdOk_Click()
'更新登录对象
If Not UpdateObject() Then
Exit Sub
End If
'变量定义
Dim DbOpResult As DbOpResult
'执行操作
If m_OpModiFlag Then '修改
DbOpResult = m_Merchandise.Update()
Else '追加
DbOpResult = m_Merchandise.AppendNew()
End If
'检查结果
Select Case DbOpResult
Case DbOpNG
lblErrorInfo = "数据库操作失败!"
Case DbOpRecExist
lblErrorInfo = "商品名已存在!"
Case DbOpRecNoExist
lblErrorInfo = "商品ID不存在!"
Case DbOpOk
Unload Me
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -