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

📄 frmshopinfo.frm

📁 VB数据库设计的代码。需要根据自己的数据库再作调整
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmShopInfo 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "连锁店信息"
   ClientHeight    =   3780
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3780
   ScaleWidth      =   4680
   StartUpPosition =   1  '所有者中心
   Begin VB.CommandButton cmdCancle 
      Caption         =   "放弃"
      Height          =   375
      Left            =   2813
      TabIndex        =   11
      Top             =   3240
      Width           =   1095
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "确认"
      Height          =   375
      Left            =   773
      TabIndex        =   10
      Top             =   3240
      Width           =   1095
   End
   Begin VB.TextBox txtPhone 
      Height          =   270
      Left            =   720
      MaxLength       =   15
      TabIndex        =   8
      Text            =   "txtPhone"
      Top             =   1560
      Width           =   3735
   End
   Begin VB.TextBox txtLeader 
      Height          =   270
      Left            =   720
      MaxLength       =   10
      TabIndex        =   7
      Text            =   "txtLeader"
      Top             =   1120
      Width           =   3735
   End
   Begin VB.TextBox txtAddress 
      Height          =   270
      Left            =   720
      MaxLength       =   50
      TabIndex        =   6
      Text            =   "txtAddress"
      Top             =   680
      Width           =   3735
   End
   Begin VB.TextBox txtShopName 
      Height          =   270
      Left            =   720
      MaxLength       =   25
      TabIndex        =   5
      Text            =   "txtShopName"
      Top             =   240
      Width           =   3735
   End
   Begin VB.Frame Frame1 
      Caption         =   "备注"
      Height          =   975
      Left            =   240
      TabIndex        =   4
      Top             =   1920
      Width           =   4215
      Begin VB.TextBox txtRemark 
         Height          =   615
         Left            =   120
         MaxLength       =   100
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   9
         Text            =   "frmShopInfo.frx":0000
         Top             =   240
         Width           =   3975
      End
   End
   Begin VB.Label lblErrorInfo 
      Caption         =   "lblErrorInfo"
      ForeColor       =   &H000000FF&
      Height          =   255
      Left            =   240
      TabIndex        =   12
      Top             =   3000
      Width           =   4215
   End
   Begin VB.Label Label4 
      AutoSize        =   -1  'True
      Caption         =   "电话"
      Height          =   180
      Left            =   240
      TabIndex        =   3
      Top             =   1605
      Width           =   360
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      Caption         =   "店长"
      Height          =   180
      Left            =   240
      TabIndex        =   2
      Top             =   1165
      Width           =   360
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "地址"
      Height          =   180
      Left            =   240
      TabIndex        =   1
      Top             =   725
      Width           =   360
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "店名"
      Height          =   180
      Left            =   240
      TabIndex        =   0
      Top             =   285
      Width           =   360
   End
End
Attribute VB_Name = "frmShopInfo"
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_Shop As clsMembershop         '当前成员店
Private m_CurrentUser As clsOpuser      '当前操作用户

'***********************************************************************
'* 过程名:DspShopInfo
'* 功  能:显示连锁店信息
'* 参  数:
'* 版  本:2006.01.02 颜志军 初版
'***********************************************************************
Private Sub DspShopInfo()
    '清空错误信息显示标签
    lblErrorInfo.Caption = ""
    
    '其它控件显示设定
    If m_OpModiFlag Then    '修改
        txtShopName.Text = m_Shop.shopName
        txtAddress.Text = m_Shop.address
        txtLeader.Text = m_Shop.leader
        txtPhone.Text = m_Shop.phone
        txtRemark.Text = m_Shop.remark
    Else    '新增
        txtShopName.Text = ""
        txtAddress.Text = ""
        txtLeader.Text = ""
        txtPhone.Text = ""
        txtRemark.Text = ""
    End If
End Sub

'***********************************************************************
'* 函数名:CheckInput
'* 功  能:检查输入信息
'* 参  数:
'* 返回值:Boolean                  True 通过 False 未通过
'* 版  本:2006.01.02 颜志军 初版
'***********************************************************************
Private Function CheckInput() As Boolean
    If IsEmpty(Trim(txtShopName.Text)) Or Trim(txtShopName.Text) = "" Then
        lblErrorInfo.Caption = "必须输入店名!"
        CheckInput = False
    ElseIf IsEmpty(Trim(txtAddress.Text)) Or Trim(txtAddress.Text) = "" Then
        lblErrorInfo.Caption = "必须输入地址!"
        CheckInput = False
    Else
        CheckInput = True
    End If
End Function

'***********************************************************************
'* 函数名:UpdateObject
'* 功  能:更新设定信息到对象
'* 参  数:
'* 返回值:Boolean
'* 版  本:2006.01.02 颜志军 初版
'***********************************************************************
Private Function UpdateObject() As Boolean
    If CheckInput() Then
        m_Shop.shopName = Trim(txtShopName.Text)
        m_Shop.address = Trim(txtAddress.Text)
        m_Shop.leader = Trim(txtLeader.Text)
        m_Shop.phone = Trim(txtPhone.Text)
        m_Shop.remark = Trim(txtRemark.Text)
        UpdateObject = True
    Else
        UpdateObject = False
    End If
End Function

'***********************************************************************
'* 过程名:ShowDlg
'* 功  能:显示对话框
'* 参  数:
'* 版  本:2006.01.02 颜志军 初版
'***********************************************************************
Public Sub ShowDlg(ByRef memberShop As clsMembershop, ByVal opFlag As Boolean, _
        ByVal currentUser As clsOpuser)
    Set m_Shop = memberShop
    Set m_CurrentUser = currentUser
    '判断权限
    If m_CurrentUser.userRank > 1 Then
        Exit Sub
    End If
    m_OpModiFlag = opFlag
    DspShopInfo
    Me.Show vbModal
End Sub

'***********************************************************************
'* 过程名:cmdCancle_Click
'* 功  能:放弃按钮按下事件响应
'* 参  数:
'* 版  本:2006.01.02 颜志军 初版
'***********************************************************************
Private Sub cmdCancle_Click()
    Unload Me
End Sub

'***********************************************************************
'* 过程名:cmdOK_Click
'* 功  能:确认按钮按下事件响应
'* 参  数:
'* 版  本:2006.01.02 颜志军 初版
'***********************************************************************
Private Sub cmdOk_Click()
    '更新登录对象
    If Not UpdateObject() Then
        Exit Sub
    End If
    
    '变量定义
    Dim DbOpResult As DbOpResult
    
    '执行操作
    If m_OpModiFlag Then    '修改
        DbOpResult = m_Shop.Update()
    Else                    '追加
        DbOpResult = m_Shop.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 + -