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

📄 xgdj.frm

📁 这是一套农村电费计算程序的源码。能够对用户电费进行计算、查询、打印。
💻 FRM
字号:
VERSION 5.00
Begin VB.Form xgdj 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "修改电价"
   ClientHeight    =   2595
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4980
   Icon            =   "xgdj.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2595
   ScaleWidth      =   4980
   ShowInTaskbar   =   0   'False
   StartUpPosition =   1  'CenterOwner
   Begin VB.CommandButton Command5 
      Cancel          =   -1  'True
      Caption         =   "退 出"
      Height          =   375
      Left            =   3960
      TabIndex        =   10
      Top             =   2040
      Width           =   735
   End
   Begin VB.TextBox Text3 
      Height          =   375
      Left            =   2160
      TabIndex        =   8
      Top             =   240
      Width           =   1215
   End
   Begin VB.CommandButton Command4 
      Caption         =   "上一个"
      Height          =   375
      Left            =   2040
      TabIndex        =   7
      Top             =   2040
      Width           =   735
   End
   Begin VB.CommandButton Command3 
      Caption         =   "下一个"
      Height          =   375
      Left            =   3000
      TabIndex        =   6
      Top             =   2040
      Width           =   735
   End
   Begin VB.CommandButton Command2 
      Caption         =   "删 除"
      Height          =   375
      Left            =   1080
      TabIndex        =   5
      Top             =   2040
      Width           =   735
   End
   Begin VB.CommandButton Command1 
      Caption         =   "增 加"
      Height          =   375
      Left            =   120
      TabIndex        =   4
      Top             =   2040
      Width           =   735
   End
   Begin VB.TextBox Text2 
      Height          =   375
      Left            =   2160
      TabIndex        =   1
      Top             =   1440
      Width           =   1335
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   2160
      TabIndex        =   0
      Top             =   840
      Width           =   1215
   End
   Begin VB.Label Label3 
      Caption         =   "代 码"
      Height          =   255
      Left            =   1320
      TabIndex        =   9
      Top             =   360
      Width           =   615
   End
   Begin VB.Label Label2 
      Caption         =   "说 明"
      Height          =   255
      Left            =   1320
      TabIndex        =   3
      Top             =   1560
      Width           =   615
   End
   Begin VB.Label Label1 
      Caption         =   "电 价"
      Height          =   255
      Left            =   1320
      TabIndex        =   2
      Top             =   960
      Width           =   615
   End
End
Attribute VB_Name = "xgdj"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public sj As Database
Public djsj As Recordset
Public tmpsj As Recordset
Private Sub Command1_Click()
    If Command1.Caption = "增 加" Then
            Command2.Enabled = False
            Command3.Enabled = False
            Command4.Enabled = False
            Text1 = ""
            Text2 = ""
            Text3 = ""
            Command1.Caption = "保 存"
        Else
            If Text1 <> "" And Text2 <> "" And Text3 <> "" Then
                    Set tmpsj = sj.OpenRecordset("select * from dj where dj!dj=" + Text1)
                    If tmpsj.RecordCount = 0 Then
                            If Val(Text1.Text) < 1 Then
                                    sj.Execute "insert into dj (djbm,dj,textm) values ('" + Text3 + "'," + Text1 + ",'" + Text2 + " ');"
                                Else
                                    ab = MsgBox(" 电价错误,请重新输入 ! ", vbOKOnly + 16, "提示")
                                    Exit Sub
                            End If
                            Command1.Caption = "增 加"
                            Command2.Enabled = True
                            Command3.Enabled = True
                            Command4.Enabled = True
                            Set djsj = sj.OpenRecordset("select * from dj")
                            djsj.MoveFirst
                            Text1 = djsj!dj
                            Text2 = djsj!Textm
                            Text3 = djsj!djbm
                        Else
                            ab = MsgBox(" 该电价已存在,请重新输入 ! ", vbOKOnly + 16, "提示")
                    End If
                Else
                    ab = MsgBox(" 请 填 全 数 据 ! ", vbOKOnly + 16, "提示")
            End If
    End If
    
End Sub

Private Sub Command2_Click()
     If djsj.RecordCount = 0 Then
          ab = MsgBox("请与管理员联系,出现无电价错误!", vbOKOnly, "提示")
          Exit Sub
     End If
    ab = MsgBox("确认删除吗?", vbYesNo + 32, "提示")
    If ab = 6 Then
    sj.Execute "delete * from dj where dj=" + Text1 + ";"
        Set djsj = sj.OpenRecordset("select * from dj")
        If djsj.RecordCount = 0 Then
             ab = MsgBox("请与管理员联系,出现无电价错误!", vbOKOnly, "提示")
             Exit Sub
        End If
        djsj.MoveFirst
        Text1 = djsj!dj
        Text2 = djsj!Textm
        Text3 = djsj!djbm
    End If
End Sub

Private Sub Command3_Click()
    If djsj.RecordCount = 0 Then
         ab = MsgBox("请与管理员联系,出现无电价错误!", vbOKOnly, "提示")
         Exit Sub
    End If
    Command4.Enabled = True
    If Not djsj.EOF Then
        djsj.MoveNext
        If djsj.EOF Then
            Command3.Enabled = False
            Exit Sub
        End If
        Text1 = djsj!dj
        Text2 = djsj!Textm
        Text3 = djsj!djbm
    End If
End Sub

Private Sub Command4_Click()
    If djsj.RecordCount = 0 Then
         ab = MsgBox("请与管理员联系,出现无电价错误!", vbOKOnly, "提示")
         Exit Sub
    End If
    Command3.Enabled = True
    If Not djsj.BOF Then
        djsj.MovePrevious
        
        If djsj.BOF Then
            Command4.Enabled = False
            Exit Sub
        End If
        Text1 = djsj!dj
        Text2 = djsj!Textm
        Text3 = djsj!djbm
    End If
End Sub

Private Sub Command5_Click()
    sj.Close
    Unload Me
End Sub

Private Sub Form_Load()
    tmp = App.Path + "\data\cjsj.mdb"
    Set sj = OpenDatabase(tmp, False, False, ";pwd=sunlm")
    Set djsj = sj.OpenRecordset("dj")
    If djsj.EOF Then
            ab = MsgBox("请与管理员联系,出现无电价错误!", vbOKOnly, "提示")
            Exit Sub
        Else
            djsj.MoveFirst
            Text1 = djsj!dj
            Text2 = djsj!Textm
            Text3 = djsj!djbm
    End If
End Sub

⌨️ 快捷键说明

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