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

📄 activexexpense.frm

📁 《VB6数据库开发指南》所有的例程的源码
💻 FRM
字号:
VERSION 5.00
Object = "{C932BA88-4374-101B-A56C-00AA003668DC}#1.1#0"; "MSMASK32.OCX"
Object = "{80C0F9FE-F92D-11D0-9AEF-004033373A8F}#27.0#0"; "ExpDetailControl.ocx"
Begin VB.Form TestDataControl 
   Caption         =   "Test Data Control"
   ClientHeight    =   3075
   ClientLeft      =   165
   ClientTop       =   795
   ClientWidth     =   6870
   LinkTopic       =   "Form1"
   ScaleHeight     =   3075
   ScaleWidth      =   6870
   StartUpPosition =   3  'Windows Default
   Begin ExpDetailControl.ctlExpenseDetail expControl 
      Height          =   1815
      Left            =   3720
      TabIndex        =   14
      Top             =   360
      Width           =   3135
      _extentx        =   5530
      _extenty        =   3201
      caption         =   "Expense Control"
   End
   Begin MSMask.MaskEdBox mskAmountSpent 
      Height          =   285
      Left            =   1440
      TabIndex        =   3
      Top             =   1320
      Width           =   2175
      _ExtentX        =   3836
      _ExtentY        =   503
      _Version        =   393216
      Format          =   "$#,##0.00;($#,##0.00)"
      PromptChar      =   "_"
   End
   Begin VB.TextBox txtSubmitDate 
      Enabled         =   0   'False
      Height          =   285
      Left            =   1440
      TabIndex        =   6
      Top             =   2400
      Width           =   2175
   End
   Begin VB.TextBox txtPurchaseDate 
      Height          =   285
      Left            =   1440
      TabIndex        =   5
      Top             =   2040
      Width           =   2175
   End
   Begin VB.TextBox txtDescription 
      Height          =   285
      Left            =   1440
      TabIndex        =   4
      Top             =   1680
      Width           =   2175
   End
   Begin VB.TextBox txtExpenseType 
      Height          =   285
      Left            =   1440
      TabIndex        =   2
      Top             =   960
      Width           =   2175
   End
   Begin VB.TextBox txtEmployeeId 
      Height          =   285
      Left            =   1440
      TabIndex        =   1
      Top             =   600
      Width           =   2175
   End
   Begin VB.TextBox txtExpenseId 
      Enabled         =   0   'False
      Height          =   285
      Left            =   1440
      TabIndex        =   0
      Top             =   240
      Width           =   2175
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "Employee:"
      Height          =   195
      Left            =   120
      TabIndex        =   13
      Top             =   600
      Width           =   735
   End
   Begin VB.Label Label7 
      AutoSize        =   -1  'True
      Caption         =   "Submission Date:"
      Height          =   195
      Left            =   120
      TabIndex        =   12
      Top             =   2400
      Width           =   1230
   End
   Begin VB.Label Label6 
      AutoSize        =   -1  'True
      Caption         =   "Purchase Date:"
      Height          =   195
      Left            =   120
      TabIndex        =   11
      Top             =   2040
      Width           =   1110
   End
   Begin VB.Label Label5 
      AutoSize        =   -1  'True
      Caption         =   "Description:"
      Height          =   195
      Left            =   120
      TabIndex        =   10
      Top             =   1680
      Width           =   840
   End
   Begin VB.Label Label4 
      AutoSize        =   -1  'True
      Caption         =   "Amount Spent:"
      Height          =   195
      Left            =   120
      TabIndex        =   9
      Top             =   1320
      Width           =   1050
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      Caption         =   "Expense Type:"
      Height          =   195
      Left            =   120
      TabIndex        =   8
      Top             =   960
      Width           =   1065
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "Expense ID:"
      Height          =   195
      Left            =   120
      TabIndex        =   7
      Top             =   240
      Width           =   870
   End
   Begin VB.Menu mnuFile 
      Caption         =   "&File"
      Begin VB.Menu mnuFileExit 
         Caption         =   "E&xit"
      End
   End
End
Attribute VB_Name = "TestDataControl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub expControl_DataChanged()
    
    ' The data has changed in the control so update the form
    Call ReadObjectValues
    
End Sub

Private Sub expControl_ValidateData(Response As ExpDetailControl.EXP_RESPONSE_TYPE, ByVal Change As ExpDetailControl.EXP_CHANGE_TYPE)
' A command button as been pushed, update the control's
' data if needed

    On Error GoTo ValidateError
    
    Select Case Change
        Case expAddNewValidate, expUpdateValidate
            Call SetObjectValues
            Response = expOk
        Case expDeleteValidate
            Response = expOk
        Case Else
            Response = expCancel
    End Select
    
    Exit Sub
ValidateError:
        MsgBox Err.Description & " from " _
            & Err.Source & " -- " _
            & CStr(Err.Number)
        Response = expCancel
        Exit Sub
    

End Sub

Private Sub Form_Load()
' Get the ActiveX object to open its database
    Dim strDbName As String
    Dim strResponse As String
    
    On Error GoTo LoadError
    
    strDbName = App.Path
    strDbName = strDbName & "\Expense.mdb"
    expControl.strDatabaseName = strDbName
    
    Exit Sub
    
LoadError:
    MsgBox Err.Description & Chr(13) & "from " & Err.Source _
            & " -- Number: " & CStr(Err.Number)
    Unload Me
    
End Sub

Private Sub SetObjectValues()
' Sets related object values from form fields

    expControl.strExpenseType = txtExpenseType.Text
    expControl.strEmployeeId = txtEmployeeId.Text
    expControl.strDescription = txtDescription.Text
    expControl.dtmDatePurchased = txtPurchaseDate.Text
    expControl.curAmountSpent = CCur(mskAmountSpent.Text)
    
    Exit Sub

End Sub
Private Sub ReadObjectValues()
' Read the object values into the form fields

    txtExpenseId.Text = CStr(expControl.lngExpenseId)
    txtEmployeeId.Text = expControl.strEmployeeId
    txtExpenseType.Text = expControl.strExpenseType
    txtDescription.Text = expControl.strDescription
    mskAmountSpent.Text = CStr(expControl.curAmountSpent)
    txtPurchaseDate.Text = CStr(expControl.dtmDatePurchased)
    txtSubmitDate.Text = CStr(expControl.dtmDateSubmitted)

End Sub

Private Sub mnuFileExit_Click()

    Unload Me

End Sub

⌨️ 快捷键说明

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