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

📄 energyconsumption.ebf

📁 < 嵌入式系统编程源代码解析>>这本书所附的代码,有了几个典型的实例,但有些看不懂,不知它是基于什么的,不好入手搞.
💻 EBF
📖 第 1 页 / 共 3 页
字号:
      TabIndex        =   11
      Top             =   720
      Width           =   480
      _cx             =   847
      _cy             =   767
      AutoSize        =   0   'False
      BackColor       =   -2147483643
      BackStyle       =   1
      BorderStyle     =   0
      Caption         =   "Billed Month"
      Enabled         =   -1  'True
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   -2147483640
      Alignment       =   2
      UseMnemonic     =   -1  'True
      WordWrap        =   0   'False
   End
   Begin VBCE.TextBox txtPresentReading 
      Height          =   255
      Left            =   2160
      TabIndex        =   10
      Top             =   2520
      Width           =   1335
      _cx             =   2355
      _cy             =   450
      BackColor       =   -2147483643
      BorderStyle     =   1
      Enabled         =   -1  'True
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   -2147483640
      Text            =   ""
      Alignment       =   0
      HideSelection   =   -1  'True
      Locked          =   0   'False
      MaxLength       =   10
      MultiLine       =   0   'False
      PasswordChar    =   ""
      ScrollBars      =   0
   End
   Begin VBCE.TextBox txtInitialReading 
      Height          =   255
      Left            =   2160
      TabIndex        =   9
      Top             =   2160
      Width           =   1335
      _cx             =   2355
      _cy             =   450
      BackColor       =   -2147483643
      BorderStyle     =   1
      Enabled         =   -1  'True
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   -2147483640
      Text            =   ""
      Alignment       =   0
      HideSelection   =   -1  'True
      Locked          =   0   'False
      MaxLength       =   10
      MultiLine       =   0   'False
      PasswordChar    =   ""
      ScrollBars      =   0
   End
   Begin VBCE.CommandButton cmdModify 
      Height          =   375
      Left            =   720
      TabIndex        =   8
      Top             =   3360
      Width           =   615
      _cx             =   1085
      _cy             =   661
      BackColor       =   12632256
      Caption         =   "&Modify"
      Enabled         =   -1  'True
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Style           =   0
   End
   Begin VBCE.CommandButton cmdSave 
      Height          =   375
      Left            =   1440
      TabIndex        =   7
      Top             =   3360
      Width           =   615
      _cx             =   1085
      _cy             =   661
      BackColor       =   12632256
      Caption         =   "&Save"
      Enabled         =   -1  'True
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Style           =   0
   End
   Begin VBCE.CommandButton cmdDelete 
      Height          =   375
      Left            =   2160
      TabIndex        =   6
      Top             =   3360
      Width           =   615
      _cx             =   1085
      _cy             =   661
      BackColor       =   12632256
      Caption         =   "&Delete"
      Enabled         =   -1  'True
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Style           =   0
   End
   Begin VBCE.CommandButton cmdClose 
      Height          =   375
      Left            =   2880
      TabIndex        =   5
      Top             =   3360
      Width           =   615
      _cx             =   1085
      _cy             =   661
      BackColor       =   12632256
      Caption         =   "E&xit"
      Enabled         =   -1  'True
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Style           =   0
   End
   Begin VBCE.CommandButton cmdNext 
      Height          =   375
      Left            =   2760
      TabIndex        =   4
      Top             =   2880
      Width           =   255
      _cx             =   450
      _cy             =   661
      BackColor       =   12632256
      Caption         =   ">"
      Enabled         =   -1  'True
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Style           =   0
   End
   Begin VBCE.CommandButton cmdPrevious 
      Height          =   375
      Left            =   2280
      TabIndex        =   3
      Top             =   2880
      Width           =   255
      _cx             =   450
      _cy             =   661
      BackColor       =   12632256
      Caption         =   "<"
      Enabled         =   -1  'True
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Style           =   0
   End
   Begin VBCE.CommandButton cmdLast 
      Height          =   375
      Left            =   3240
      TabIndex        =   2
      Top             =   2880
      Width           =   255
      _cx             =   450
      _cy             =   661
      BackColor       =   12632256
      Caption         =   ">|"
      Enabled         =   -1  'True
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Style           =   0
   End
   Begin VBCE.CommandButton cmdADD 
      Height          =   375
      Left            =   0
      TabIndex        =   1
      Top             =   3360
      Width           =   615
      _cx             =   1085
      _cy             =   661
      BackColor       =   12632256
      Caption         =   "&New"
      Enabled         =   -1  'True
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Style           =   0
   End
   Begin VBCE.CommandButton cmdFirst 
      Height          =   375
      Left            =   1800
      TabIndex        =   0
      Top             =   2880
      Width           =   255
      _cx             =   450
      _cy             =   661
      BackColor       =   12632256
      Caption         =   "|<"
      Enabled         =   -1  'True
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Style           =   0
   End
End
Attribute VB_Name = "frmEnergyMeter"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
' Form Global Declarations
Dim CNEnergyMeter As ADOCE.Connection
Dim RSEnergyMeter As ADOCE.Recordset
Dim RSEnergyMeterSave As ADOCE.Recordset
Dim RSEnergyMeterModify As ADOCE.Recordset
Dim RSEnergyMeterNew As ADOCE.Recordset
Dim MyQuery As String
Dim MyQueryNew As String
Dim MyQueryModify As String
Dim MyButtonAction As String
Dim MyFirstBookMark As Variant
Dim MyLastBookMark As Variant
Dim MyCurrentBookMark As Variant
Dim ModifySNo As String
Dim MyMonth As String
Dim MyMonthText As String
' This control event is to enter data for new record.
Private Sub cmdADD_Click()
    EnableFields
    txtSNo.SetFocus
    MyButtonAction = "New"
    ClearAllFields
    cmdClose.Caption = "Cancel"
    DisablecmdButtons
    cmdSave.Enabled = False
    txtDate.Enabled = False
    txtInitialReading.Enabled = False
    cboMonths.Enabled = False
    txtAddress.Enabled = False
    AddMonthsToComboBox
    BilledMonthToComboBox
    txtDate.Text = Date
      
End Sub
'This control event is to cancel the operation or close the application.
Private Sub cmdClose_Click()
    If cmdClose.Caption = "Exit" Then
        Form_OKClick
    Else
        EnablecmdButtons
        cmdClose.Caption = "Exit"
       MyButtonAction = ""
        ClearAllFields
        Display
        DisableFields

    End If
End Sub
'This control event is to delete a record.
Private Sub cmdDelete_Click()
    MyQuery = "Select * FROM EnergyMeter where SNo='" & txtSNo.Text & "'"
    Set RSEnergyMeterModify = CreateObject("ADOCE.Recordset.3.0")
    RSEnergyMeterModify.Open MyQuery, CNEnergyMeter, adOpenKeyset, adLockOptimistic
    If RSEnergyMeterModify.RecordCount > 0 Then
        Dim MyVar
        MyVar = MsgBox("Do You Want to Delete?", 65, "EnergyMeter")
        If MyVar = 1 Then
            RSEnergyMeterModify.Delete
            RSEnergyMeterModify.Close
            Set RSEnergyMeterModify = Nothing
            RefreshDB
            RSEnergyMeter.MoveFirst
            EnableFields
            ClearAllFields
            Display
            DisableFields
        Else
            MsgBox "NO Record Deleted"
            RSEnergyMeterModify.Close
            Set RSEnergyMeterModify = Nothing
        End If
    Else
        MsgBox "NO Record to Delete"
        RSEnergyMeterModify.Close
        Set RSEnergyMeterModify = Nothing
    End If
End Sub
' This control event is to Display the first record
Private Sub cmdFirst_Click()
    cmdSave.Enabled = False
    ClearAllFields
    RSEnergyMeter.MoveFirst
    Display
End Sub
' This control event is to Display the last record
Private Sub cmdLast_Click()
    cmdSave.Enabled = False
    ClearAllFields
    RSEnergyMeter.MoveLast
    Display
End Sub
' This control event is to get the record to be modified
Private Sub cmdModify_Click()
    EnableFields
    txtSNo.SetFocus
    txtMeterNo.Enabled = False
    txtDate.Enabled = False
    cboMonths.Enabled = False
    txtInitialReading.Enabled = False

⌨️ 快捷键说明

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