frmdls_edit.frm

来自「音像店(CD刻录)进销存管理系统」· FRM 代码 · 共 202 行

FRM
202
字号
VERSION 5.00
Begin VB.Form frmDLS_Edit 
   Caption         =   "代理商信息编辑"
   ClientHeight    =   4170
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   5955
   LinkTopic       =   "Form1"
   ScaleHeight     =   4170
   ScaleWidth      =   5955
   StartUpPosition =   1  '所有者中心
   Begin VB.Frame Frame2 
      Height          =   555
      Left            =   1350
      TabIndex        =   12
      Top             =   3330
      Width           =   3075
      Begin VB.CommandButton cmdOK 
         Caption         =   "确  定"
         Height          =   300
         Left            =   315
         TabIndex        =   5
         Top             =   180
         Width           =   1000
      End
      Begin VB.CommandButton cmdCancel 
         Caption         =   "取  消"
         Height          =   300
         Left            =   1755
         TabIndex        =   13
         TabStop         =   0   'False
         Top             =   180
         Width           =   1000
      End
   End
   Begin VB.Frame Frame1 
      Height          =   2850
      Left            =   135
      TabIndex        =   6
      Top             =   225
      Width           =   5640
      Begin VB.TextBox txtDH 
         Height          =   300
         Left            =   1305
         TabIndex        =   4
         Top             =   2160
         Width           =   2850
      End
      Begin VB.TextBox txtDZ 
         Height          =   300
         Left            =   1305
         TabIndex        =   3
         Top             =   1710
         Width           =   4020
      End
      Begin VB.TextBox txtLBXM 
         Height          =   300
         Left            =   1305
         TabIndex        =   2
         Top             =   1260
         Width           =   1455
      End
      Begin VB.TextBox txtDaiHao 
         Height          =   300
         Left            =   1305
         TabIndex        =   1
         Top             =   810
         Width           =   1455
      End
      Begin VB.TextBox txtMingCheng 
         Height          =   300
         Left            =   1305
         TabIndex        =   0
         Top             =   360
         Width           =   2850
      End
      Begin VB.Label Label1 
         Alignment       =   2  'Center
         Caption         =   "电话"
         Height          =   240
         Index           =   4
         Left            =   270
         TabIndex        =   11
         Top             =   2205
         Width           =   1050
      End
      Begin VB.Label Label1 
         Alignment       =   2  'Center
         Caption         =   "地址"
         Height          =   240
         Index           =   3
         Left            =   270
         TabIndex        =   10
         Top             =   1755
         Width           =   1050
      End
      Begin VB.Label Label1 
         Caption         =   "老板姓名"
         Height          =   240
         Index           =   2
         Left            =   225
         TabIndex        =   9
         Top             =   1305
         Width           =   1050
      End
      Begin VB.Label Label1 
         Caption         =   "代理商代号"
         Height          =   240
         Index           =   1
         Left            =   225
         TabIndex        =   8
         Top             =   855
         Width           =   1050
      End
      Begin VB.Label Label1 
         Caption         =   "代理商名称"
         Height          =   240
         Index           =   0
         Left            =   225
         TabIndex        =   7
         Top             =   405
         Width           =   1050
      End
   End
End
Attribute VB_Name = "frmDLS_Edit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public DLS_ID As Long
Public Modify As Boolean

Dim MyDLS As New clsDaiLiShang

Private Sub cmdCancel_Click()
  Unload Me
End Sub

Private Sub cmdOK_Click()
  '检查录入数据的有效性
  If Trim(txtMingCheng.Text) = "" Then
    MsgBox "请输入代理商名称!", , "警告"
    txtMingCheng.SetFocus
    Exit Sub
  End If
  If Trim(txtDaiHao.Text) = "" Then
    MsgBox "请输入代理商代号!", , "警告"
    txtDaiHao.SetFocus
    Exit Sub
  End If
  
  '把用户录入的数据复制到对象MyDLS中
  With MyDLS
    .MingCheng = Trim(txtMingCheng.Text)
    .DaiHao = Trim(txtDaiHao.Text)
    .LBXM = Trim(txtLBXM.Text)
    .DZ = Trim(txtDZ.Text)
    .DH = Trim(txtDH.Text)
    
    '为Insert检查代理商名称是否已存在
    If Modify = False Then
      If .In_DB(Trim(txtMingCheng.Text)) = True Then
        MsgBox "你输入的代理商名称已存在,请检查。", , "提示"
        txtMingCheng.SetFocus
        txtMingCheng.SelStart = 0
        txtMingCheng.SelLength = Len(txtMingCheng.Text)
        Exit Sub
      End If
    End If
    
    If Modify = False Then
      .Insert
    Else
      .Update (DLS_ID)
    End If
  End With
  
  Unload Me
End Sub

Private Sub txtDaiHao_KeyPress(KeyAscii As Integer)
  EnterTAB KeyAscii
End Sub

Private Sub txtDH_KeyPress(KeyAscii As Integer)
  EnterTAB KeyAscii
End Sub

Private Sub txtDZ_KeyPress(KeyAscii As Integer)
  EnterTAB KeyAscii
End Sub

Private Sub txtLBXM_KeyPress(KeyAscii As Integer)
  EnterTAB KeyAscii
End Sub

Private Sub txtMingCheng_KeyPress(KeyAscii As Integer)
  EnterTAB KeyAscii
End Sub

⌨️ 快捷键说明

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