⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmmerchandisekind.frm

📁 VB数据库设计的代码。需要根据自己的数据库再作调整
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmMerchandisekind 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "商品类别信息"
   ClientHeight    =   3195
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   3885
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3195
   ScaleWidth      =   3885
   StartUpPosition =   1  '所有者中心
   Begin VB.CommandButton cmdCancle 
      Caption         =   "放弃"
      Height          =   375
      Left            =   2235
      TabIndex        =   5
      Top             =   2640
      Width           =   975
   End
   Begin VB.CommandButton cmdOk 
      Caption         =   "确认"
      Height          =   375
      Left            =   675
      TabIndex        =   4
      Top             =   2640
      Width           =   975
   End
   Begin VB.TextBox txtKindName 
      Height          =   270
      Left            =   1440
      TabIndex        =   3
      Text            =   "txtKindName"
      Top             =   240
      Width           =   2175
   End
   Begin VB.Frame Frame1 
      Caption         =   "备注"
      Height          =   1455
      Left            =   240
      TabIndex        =   1
      Top             =   720
      Width           =   3495
      Begin VB.TextBox txtRemark 
         Height          =   1095
         Left            =   120
         MaxLength       =   100
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   2
         Text            =   "frmMerchandisekind.frx":0000
         Top             =   240
         Width           =   3255
      End
   End
   Begin VB.Label lblErrorInfo 
      Caption         =   "lblErrorInfo"
      ForeColor       =   &H000000FF&
      Height          =   255
      Left            =   240
      TabIndex        =   6
      Top             =   2280
      Width           =   3495
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "商口类别名称"
      Height          =   180
      Left            =   240
      TabIndex        =   0
      Top             =   240
      Width           =   1080
   End
End
Attribute VB_Name = "frmMerchandisekind"
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_Merchandisekind As clsMerchandisekind      '当前商品类别
Private m_CurrentUser As clsOpuser                   '当前操作用户

'***********************************************************************
'* 过程名:DspKindInfo
'* 功  能:显示商品类别信息
'* 参  数:
'* 版  本:2006.01.03 颜志军 初版
'***********************************************************************
Private Sub DspKindInfo()
    '清空错误信息显示标签
    lblErrorInfo.Caption = ""
    
    '其它控件显示设定
    If m_OpModiFlag Then    '修改
        txtKindName.Text = m_Merchandisekind.kindName
        txtRemark.Text = m_Merchandisekind.remark
    Else    '新增
        txtKindName.Text = ""
        txtRemark.Text = ""
    End If
End Sub

'***********************************************************************
'* 函数名:CheckInput
'* 功  能:检查输入信息
'* 参  数:
'* 返回值:Boolean                  True 通过 False 未通过
'* 版  本:2006.01.03 颜志军 初版
'***********************************************************************
Private Function CheckInput() As Boolean
    If IsEmpty(Trim(txtKindName.Text)) Or Trim(txtKindName.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_Merchandisekind.kindName = Trim(txtKindName.Text)
        m_Merchandisekind.remark = Trim(txtRemark.Text)
        UpdateObject = True
    Else
        UpdateObject = False
    End If
End Function

'***********************************************************************
'* 过程名:ShowDlg
'* 功  能:显示对话框
'* 参  数:
'* 版  本:2006.01.03 颜志军 初版
'***********************************************************************
Public Sub ShowDlg(ByRef curMerchandisekind As clsMerchandisekind, _
            ByVal opFlag As Boolean, _
        ByVal currentUser As clsOpuser)
    Set m_Merchandisekind = curMerchandisekind
    Set m_CurrentUser = currentUser
    m_OpModiFlag = opFlag
    DspKindInfo
    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_Merchandisekind.Update()
    Else                    '追加
        DbOpResult = m_Merchandisekind.AppendNew()
    End If
    
    '检查结果
    Select Case DbOpResult
    Case DbOpNG
        lblErrorInfo = "数据库操作失败!"
    Case DbOpRecExist
        lblErrorInfo = "商品类型名已存在!"
    Case DbOpRecNoExist
        lblErrorInfo = "商品类型不存在!"
    Case DbOpOk
        Unload Me
    End Select
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -