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

📄 frmuserturnon_engineering_input.frm

📁 自来水公司的一个管理系统
💻 FRM
字号:
VERSION 5.00
Object = "{788A625E-3B1F-4033-A5F8-E30D17B1FF43}#8.0#0"; "DecEdBox.ocx"
Begin VB.Form frmUserTurnOn_Engineering_Input 
   Caption         =   "材料明细表操作"
   ClientHeight    =   1860
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   7845
   Icon            =   "frmUserTurnOn_Engineering_Input.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   1860
   ScaleWidth      =   7845
   StartUpPosition =   1  '所有者中心
   Begin VB.CommandButton cmdArray2 
      Caption         =   "放弃"
      Height          =   315
      Index           =   1
      Left            =   4095
      TabIndex        =   9
      Top             =   1440
      Width           =   945
   End
   Begin VB.CommandButton cmdArray2 
      Caption         =   "确认"
      Height          =   315
      Index           =   0
      Left            =   3165
      TabIndex        =   8
      Top             =   1440
      Width           =   945
   End
   Begin VB.CommandButton cmdArray1 
      Caption         =   "删除"
      Height          =   315
      Index           =   2
      Left            =   1980
      TabIndex        =   2
      Top             =   1440
      Width           =   945
   End
   Begin VB.CommandButton cmdArray1 
      Caption         =   "编辑"
      Height          =   315
      Index           =   1
      Left            =   1050
      TabIndex        =   1
      Top             =   1440
      Width           =   945
   End
   Begin VB.CommandButton cmdArray1 
      Caption         =   "新增"
      Height          =   315
      Index           =   0
      Left            =   120
      TabIndex        =   0
      Top             =   1440
      Width           =   945
   End
   Begin VB.Frame Frame1 
      Height          =   1245
      Left            =   90
      TabIndex        =   10
      Top             =   45
      Width           =   7275
      Begin VB.ComboBox cboStuffFromType 
         Height          =   300
         ItemData        =   "frmUserTurnOn_Engineering_Input.frx":0442
         Left            =   6195
         List            =   "frmUserTurnOn_Engineering_Input.frx":0444
         Style           =   2  'Dropdown List
         TabIndex        =   7
         Top             =   630
         Width           =   870
      End
      Begin DecEdBox.DecEditBox debStuffQuantity 
         Height          =   315
         Left            =   2685
         TabIndex        =   5
         Top             =   630
         Width           =   1110
         _ExtentX        =   1958
         _ExtentY        =   556
      End
      Begin VB.TextBox txtStuffSpec 
         Height          =   315
         Left            =   690
         MaxLength       =   60
         TabIndex        =   4
         Top             =   630
         Width           =   1335
      End
      Begin VB.TextBox txtStuffName 
         Height          =   330
         Left            =   690
         MaxLength       =   60
         TabIndex        =   3
         Top             =   285
         Width           =   6360
      End
      Begin DecEdBox.DecEditBox debStuffFee 
         Height          =   315
         Left            =   4440
         TabIndex        =   6
         Top             =   630
         Width           =   1110
         _ExtentX        =   1958
         _ExtentY        =   556
      End
      Begin VB.Label lblPrompt 
         Caption         =   "类别:"
         Height          =   210
         Index           =   4
         Left            =   5670
         TabIndex        =   15
         Top             =   675
         Width           =   555
      End
      Begin VB.Label lblPrompt 
         Caption         =   "金额:"
         Height          =   210
         Index           =   3
         Left            =   3915
         TabIndex        =   14
         Top             =   675
         Width           =   555
      End
      Begin VB.Label lblPrompt 
         Caption         =   "数量:"
         Height          =   210
         Index           =   2
         Left            =   2160
         TabIndex        =   13
         Top             =   690
         Width           =   555
      End
      Begin VB.Label lblPrompt 
         Caption         =   "规格:"
         Height          =   210
         Index           =   1
         Left            =   165
         TabIndex        =   12
         Top             =   675
         Width           =   555
      End
      Begin VB.Label lblPrompt 
         Caption         =   "名称:"
         Height          =   210
         Index           =   0
         Left            =   165
         TabIndex        =   11
         Top             =   345
         Width           =   555
      End
   End
End
Attribute VB_Name = "frmUserTurnOn_Engineering_Input"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Public adoConDetailRSref As ADODB.Recordset '用于指向父表单的adoConDetailRS对象

Dim blnEditFlag As Boolean      '编辑标志,当对内容做任何改动时,该变量置为True
Dim bytCmdFlag  As Byte         '记录第一组按钮的按下信息,从而可以在第二组按钮中知道上一步第一组按钮是谁按下的
Dim intStuffFromTypeOldIndex As Integer     '用于保留每次进入cboStuffFromType控件时的listindex属性
                                            '从而模拟Change事件,注:对于常规列表框(ComboBox)的Change事件
                                            '是在文本手工改动后发生,而不象数据绑定列表框(DataCombo)那样,只要
                                            '选择了不同项就产生Change事件,因此要模拟该事件

Private Sub cboStuffFromType_LostFocus()
    If Me.cboStuffFromType.ListIndex <> intStuffFromTypeOldIndex Then
        intStuffFromTypeOldIndex = Me.cboStuffFromType.ListIndex
        blnEditFlag = True
    End If
    
End Sub

Private Sub cmdArray1_Click(Index As Integer)
    Dim bytReturnFlag As Byte
    
    bytCmdFlag = Index
    Select Case Index
    Case 0  '新增
        Call ClearInterFace
        Call EnableInterFace
        Call DisableCMD1
        Call EnableCMD2
        Me.txtStuffName.SetFocus
    Case 1  '编辑
        If Trim(Me.txtStuffName.Text) = "" Then Exit Sub
        Call EnableInterFace
        Call DisableCMD1
        Call EnableCMD2
        Me.txtStuffName.SetFocus
    Case 2  '删除
        If Trim(Me.txtStuffName.Text) = "" Then Exit Sub
        bytReturnFlag = MsgBox("确定要删除本条记录吗?", vbYesNo + vbDefaultButton2, "提示信息")
        If bytReturnFlag = vbYesNo Then Exit Sub
        '删除
        On Error GoTo errHandleDel
        adoConDetailRSref.Delete
        On Error GoTo 0
        On Error Resume Next
        adoConDetailRSref.MoveNext
        If adoConDetailRSref.EOF Then adoConDetailRSref.MovePrevious
        On Error GoTo 0
        Unload Me
    blnEditFlag = False
    End Select
    Exit Sub
    
errHandleDel:
    Warning "删除记录失败!" & Chr(13) & Err.Description
    On Error GoTo 0
End Sub

Private Sub cmdArray2_Click(Index As Integer)
    Select Case Index
    Case 0  '保存
        If Trim(Me.txtStuffName.Text) = "" Then
            Beep
            Warning "名称不能为空!!!"
            Me.txtStuffName.SetFocus
            Exit Sub
        End If
        If Not blnEditFlag Then
            Call DisableInterFace
            Call InitCMD
            Exit Sub
        End If
        
        If bytCmdFlag = 0 Then      '新增--保存
            On Error GoTo errHandleSave
            adoConDetailRSref.AddNew
            adoConDetailRSref!StuffName = Trim(Me.txtStuffName.Text)
            adoConDetailRSref!StuffSpec = Trim(Me.txtStuffSpec.Text)
            adoConDetailRSref!StuffQuantity = Me.debStuffQuantity.Text
            adoConDetailRSref!StuffFee = Me.debStuffFee.Text
            adoConDetailRSref!StuffFromType = Trim(Me.cboStuffFromType.Text)
            adoConDetailRSref.Update
            On Error GoTo 0
            On Error Resume Next
            adoConDetailRSref.MoveLast
            On Error GoTo 0
        ElseIf bytCmdFlag = 1 Then  '编辑--保存
            On Error GoTo errHandleSave
            adoConDetailRSref!StuffName = Trim(Me.txtStuffName.Text)
            adoConDetailRSref!StuffSpec = Trim(Me.txtStuffSpec.Text)
            adoConDetailRSref!StuffQuantity = Me.debStuffQuantity.Text
            adoConDetailRSref!StuffFee = Me.debStuffFee.Text
            adoConDetailRSref!StuffFromType = Trim(Me.cboStuffFromType.Text)
            adoConDetailRSref.Update
            On Error GoTo 0
        End If
        
        Call DisableInterFace
        Call InitCMD
        blnEditFlag = False
    
    Case 1  '放弃
        Call InitInterFace
        Call DisableInterFace
        Call InitCMD
        blnEditFlag = False
    End Select
    Exit Sub
    
errHandleSave:
    Warning "保存记录失败!" & Chr(13) & Err.Description
    On Error GoTo 0
End Sub

Private Sub Form_Load()
    '设置控件关键属性
    Me.debStuffQuantity.MaxLen = 9
    Me.debStuffFee.MaxLen = 9
    Me.cboStuffFromType.AddItem ("公司")
    Me.cboStuffFromType.AddItem ("自备")
    
    '初始化界面
    Call InitInterFace
    Call DisableInterFace
    Call InitCMD
    
    blnEditFlag = False
End Sub

Private Sub DisableInterFace()
    Me.txtStuffName.Enabled = False
    Me.txtStuffSpec.Enabled = False
    Me.debStuffQuantity.Enabled = False
    Me.debStuffFee.Enabled = False
    Me.cboStuffFromType.Enabled = False
End Sub

Private Sub EnableInterFace()
    Me.txtStuffName.Enabled = True
    Me.txtStuffSpec.Enabled = True
    Me.debStuffQuantity.Enabled = True
    Me.debStuffFee.Enabled = True
    Me.cboStuffFromType.Enabled = True
End Sub

Private Sub ClearInterFace()
    Me.txtStuffName.Text = ""
    Me.txtStuffSpec.Text = ""
    Me.debStuffQuantity.Text = 0
    Me.debStuffFee.Text = 0
    Me.cboStuffFromType.ListIndex = 0
End Sub


Private Sub EnableCMD1()
    Me.cmdArray1(0).Enabled = True
    Me.cmdArray1(1).Enabled = True
    Me.cmdArray1(2).Enabled = True
End Sub

Private Sub DisableCMD1()
    Me.cmdArray1(0).Enabled = False
    Me.cmdArray1(1).Enabled = False
    Me.cmdArray1(2).Enabled = False
End Sub

Private Sub EnableCMD2()
    Me.cmdArray2(0).Enabled = True
    Me.cmdArray2(1).Enabled = True
End Sub

Private Sub DisableCMD2()
    Me.cmdArray2(0).Enabled = False
    Me.cmdArray2(1).Enabled = False
End Sub

Private Sub InitCMD()
    If adoConDetailRSref.EOF Or adoConDetailRSref.BOF Then
        Me.cmdArray1(0).Enabled = True
        Me.cmdArray1(1).Enabled = False
        Me.cmdArray1(2).Enabled = False
    Else
        Me.cmdArray1(0).Enabled = True
        Me.cmdArray1(1).Enabled = True
        Me.cmdArray1(2).Enabled = True
    End If
    Call DisableCMD2
End Sub

Private Sub InitInterFace()
    If adoConDetailRSref.EOF Or adoConDetailRSref.BOF Then
        Me.txtStuffName.Text = ""
        Me.txtStuffSpec.Text = ""
        Me.debStuffQuantity.Text = 0
        Me.debStuffFee.Text = 0
        Me.cboStuffFromType.ListIndex = 0
    Else
        Me.txtStuffName.Text = adoConDetailRSref!StuffName
        Me.txtStuffSpec.Text = adoConDetailRSref!StuffSpec
        Me.debStuffQuantity.Text = adoConDetailRSref!StuffQuantity
        Me.debStuffFee.Text = adoConDetailRSref!StuffFee
        Me.cboStuffFromType.Text = Trim(adoConDetailRSref!StuffFromType)
    End If
End Sub

Private Sub txtStuffName_Change()
    blnEditFlag = True
End Sub

Private Sub txtStuffName_GotFocus()
    Call AutoSelectText(txtStuffName)
End Sub

Private Sub txtStuffName_KeyPress(KeyAscii As Integer)
    Call IfEnterKeyMoveNext(KeyAscii)
End Sub

Private Sub txtStuffSpec_Change()
    blnEditFlag = True
End Sub

Private Sub debStuffFee_Change()
    blnEditFlag = True
End Sub

Private Sub debStuffQuantity_Change()
    blnEditFlag = True
End Sub

Private Sub txtStuffSpec_GotFocus()
    Call AutoSelectText(txtStuffSpec)
End Sub

Private Sub txtStuffSpec_KeyPress(KeyAscii As Integer)
    Call IfEnterKeyMoveNext(KeyAscii)
End Sub

Private Sub cboStuffFromType_KeyPress(KeyAscii As Integer)
    Call IfEnterKeyMoveNext(KeyAscii)
End Sub

Private Sub debStuffFee_KeyPress(ByVal KeyAscii As Integer)
    Call IfEnterKeyMoveNext(KeyAscii)
End Sub

Private Sub debStuffQuantity_KeyPress(ByVal KeyAscii As Integer)
    Call IfEnterKeyMoveNext(KeyAscii)
End Sub

⌨️ 快捷键说明

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