frmwarehouseupdate.frm

来自「很好! 很实用! 免费!」· FRM 代码 · 共 103 行

FRM
103
字号
VERSION 5.00
Begin VB.Form frmWarehouseUpdate 
   Caption         =   "Form1"
   ClientHeight    =   6945
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   9930
   LinkTopic       =   "Form1"
   ScaleHeight     =   6945
   ScaleWidth      =   9930
   StartUpPosition =   3  'Windows Default
   Begin VB.TextBox txtName 
      Height          =   375
      Left            =   6120
      MaxLength       =   20
      TabIndex        =   3
      Top             =   2880
      Width           =   2295
   End
   Begin VB.TextBox txtNo 
      Height          =   375
      Left            =   2760
      MaxLength       =   10
      TabIndex        =   2
      Top             =   2880
      Width           =   1455
   End
   Begin VB.CommandButton cmdCancel 
      Cancel          =   -1  'True
      Caption         =   "取消"
      Height          =   375
      Left            =   7440
      TabIndex        =   1
      Top             =   6120
      Width           =   1095
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "确定"
      Height          =   375
      Left            =   6240
      TabIndex        =   0
      Top             =   6120
      Width           =   1095
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "仓库名称"
      Height          =   195
      Left            =   5280
      TabIndex        =   5
      Top             =   2880
      Width           =   720
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "仓库编号"
      Height          =   195
      Left            =   1920
      TabIndex        =   4
      Top             =   2880
      Width           =   720
   End
End
Attribute VB_Name = "frmWarehouseUpdate"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit


Private Sub cmdCancel_Click()
    Unload Me
End Sub

Private Sub cmdOK_Click()
'编辑仓库
Dim objWarehouse As New clsWarehouse

    With objWarehouse
        .m_ID = frmWarehouse.ExcelGrid1.DataRecordset.Fields("ID").value
        .m_Name = Me.txtName.Text
        .m_No = Me.txtNo.Text
        If Not .Update() Then
            MsgBox "更新失败,请检查数据合法性!", vbInformation, "编辑仓库"
        Else
            Unload Me
            frmWarehouse.RefreshData
        End If
    End With
End Sub

Private Sub Form_Load()
    'center the form
    Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2
    '写入数据到界面
    Me.txtName.Text = frmWarehouse.ExcelGrid1.DataRecordset.Fields("name").value
    Me.txtNo.Text = frmWarehouse.ExcelGrid1.DataRecordset.Fields("empno").value
End Sub



⌨️ 快捷键说明

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