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

📄 frmyhsd.frm

📁 农村水电费记帐录入
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form FRMYHSD 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "用户设定"
   ClientHeight    =   2970
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6585
   Icon            =   "frmyhsd.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2970
   ScaleWidth      =   6585
   StartUpPosition =   2  '屏幕中心
   Begin VB.Frame Frame2 
      Height          =   1935
      Left            =   2640
      TabIndex        =   4
      Top             =   960
      Width           =   3855
      Begin VB.TextBox Text1 
         Height          =   270
         Left            =   1080
         TabIndex        =   10
         Top             =   240
         Width           =   1095
      End
      Begin VB.ComboBox Combo1 
         Height          =   300
         ItemData        =   "frmyhsd.frx":0442
         Left            =   1080
         List            =   "frmyhsd.frx":044C
         TabIndex        =   9
         Top             =   720
         Width           =   1095
      End
      Begin VB.TextBox Text2 
         Height          =   270
         Left            =   1080
         TabIndex        =   8
         Top             =   1200
         Width           =   1095
      End
      Begin VB.CommandButton Command1 
         Caption         =   "添加用户"
         BeginProperty Font 
            Name            =   "楷体_GB2312"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   2400
         TabIndex        =   7
         Top             =   240
         Width           =   975
      End
      Begin VB.CommandButton Command2 
         Caption         =   "删除用户"
         BeginProperty Font 
            Name            =   "楷体_GB2312"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   2400
         TabIndex        =   6
         Top             =   720
         Width           =   975
      End
      Begin VB.CommandButton Command3 
         Caption         =   "返回"
         BeginProperty Font 
            Name            =   "楷体_GB2312"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   2400
         TabIndex        =   5
         Top             =   1200
         Width           =   975
      End
      Begin VB.Label Label1 
         Caption         =   "姓名:"
         BeginProperty Font 
            Name            =   "华文细黑"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   240
         TabIndex        =   13
         Top             =   240
         Width           =   615
      End
      Begin VB.Label Label2 
         Caption         =   "权限:"
         BeginProperty Font 
            Name            =   "华文细黑"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   240
         TabIndex        =   12
         Top             =   720
         Width           =   735
      End
      Begin VB.Label Label3 
         Caption         =   "密码:"
         BeginProperty Font 
            Name            =   "华文细黑"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   240
         TabIndex        =   11
         Top             =   1200
         Width           =   615
      End
   End
   Begin VB.Frame Frame1 
      Height          =   855
      Left            =   2640
      TabIndex        =   1
      Top             =   0
      Width           =   3855
      Begin VB.OptionButton Option1 
         Caption         =   "添加用户"
         BeginProperty Font 
            Name            =   "楷体_GB2312"
            Size            =   15
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   240
         TabIndex        =   3
         Top             =   360
         Width           =   1695
      End
      Begin VB.OptionButton Option2 
         Caption         =   "删除用户"
         BeginProperty Font 
            Name            =   "楷体_GB2312"
            Size            =   15
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   2040
         TabIndex        =   2
         Top             =   360
         Width           =   1695
      End
   End
   Begin MSComctlLib.ListView ListView1 
      Height          =   2775
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   2415
      _ExtentX        =   4260
      _ExtentY        =   4895
      View            =   3
      Arrange         =   2
      LabelEdit       =   1
      LabelWrap       =   -1  'True
      HideSelection   =   0   'False
      GridLines       =   -1  'True
      _Version        =   393217
      ForeColor       =   -2147483640
      BackColor       =   -2147483643
      BorderStyle     =   1
      Appearance      =   0
      NumItems        =   3
      BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         Text            =   "姓名"
         Object.Width           =   2540
      EndProperty
      BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   1
         Text            =   "操作权限"
         Object.Width           =   2540
      EndProperty
      BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   2
         Text            =   "密码"
         Object.Width           =   2540
      EndProperty
   End
End
Attribute VB_Name = "FRMYHSD"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If Text1.Text = "" Or Combo1.Text = "" Or Text2.Text = "" Then
MsgBox "数据不完整,请重新输入"
Exit Sub
End If

Set rec = New ADODB.Recordset
rec.Open "select * from 密码表 where 姓名='" & Text1.Text & "'and 操作权限='" & Combo1.Text & "'and 密码='" & Text2.Text & "'", gCnn, 3, 3
If rec.EOF = False Then
MsgBox "此用户已经存在,请重试"
Exit Sub
rec.Close
Else

Set rec = New ADODB.Recordset
rec.Open "select * from 密码表", gCnn, 3, 3
rec.AddNew
rec("姓名") = Text1.Text
rec("操作权限") = Combo1.Text
rec("密码") = Text2.Text
rec.Update
rec.Close
MsgBox "添加用户成功"
Text1.Text = ""
Combo1.Text = ""
Text2.Text = ""
End If

Dim b As ListItem
Set rec = New ADODB.Recordset
rec.Open "select * from 密码表", gCnn, 3, 3
 ListView1.ListItems.Clear
If Not rec.EOF Then
  Do Until rec.EOF
  
  Set b = ListView1.ListItems.Add(, , rec("姓名"))
  b.SubItems(1) = rec("操作权限")
  b.SubItems(2) = rec("密码")
  rec.MoveNext
  Loop
  rec.Close
End If
End Sub

Private Sub Command2_Click()
Set rec = New ADODB.Recordset
rec.Open "select * from 密码表 where 姓名='" & Text1.Text & "'and 操作权限='" & Combo1.Text & "'and 密码='" & Text2.Text & "'", gCnn, 3, 3
If rec.EOF = False Then
    rec.Delete
    rec.Update
    rec.Close
    MsgBox "删除用户成功"
    Text1.Text = ""
    Combo1.Text = ""
    Text2.Text = ""
Else
    MsgBox "没有这个用户"
    Exit Sub
    rec.Close
End If
Dim c As ListItem
Set rec = New ADODB.Recordset
rec.Open "select * from 密码表", gCnn, 3, 3
 ListView1.ListItems.Clear
If Not rec.EOF Then
  Do Until rec.EOF
  
  Set c = ListView1.ListItems.Add(, , rec("姓名"))
  c.SubItems(1) = rec("操作权限")
  c.SubItems(2) = rec("密码")
  rec.MoveNext
  Loop
  rec.Close
End If
End Sub

Private Sub Command3_Click()
Unload Me
End Sub

Private Sub Form_Activate()
Command1.Enabled = False
Command2.Enabled = False
End Sub

Private Sub Form_Load()
Dim a As ListItem
Set rec = New ADODB.Recordset
rec.Open "select * from 密码表", gCnn, 3, 3
 ListView1.ListItems.Clear
If Not rec.EOF Then
  Do Until rec.EOF
  
  Set a = ListView1.ListItems.Add(, , rec("姓名"))
  a.SubItems(1) = rec("操作权限")
  a.SubItems(2) = rec("密码")
  rec.MoveNext
  Loop
  rec.Close
End If
End Sub

Private Sub Option1_Click()
If Option1.Value = True Then
Command1.Enabled = True
Command2.Enabled = False
End If
End Sub

Private Sub Option2_Click()
If Option2.Value = True Then
Command1.Enabled = False
Command2.Enabled = True
End If

End Sub

⌨️ 快捷键说明

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