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

📄 setper.frm

📁 vb做的电气设备管理系统的完整版毕业设计 有源码 论文 测试报告
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form SetPer 
   BackColor       =   &H00E0E0E0&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "管理员设置"
   ClientHeight    =   4035
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   5430
   Icon            =   "SetPer.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4035
   ScaleWidth      =   5430
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton cmdExit 
      BackColor       =   &H00FFFFFF&
      Caption         =   "关闭"
      Height          =   375
      Left            =   4185
      Style           =   1  'Graphical
      TabIndex        =   14
      Top             =   3285
      Width           =   915
   End
   Begin VB.CommandButton cmdSave 
      BackColor       =   &H00FFFFFF&
      Caption         =   "保存"
      Enabled         =   0   'False
      Height          =   375
      Left            =   3285
      Style           =   1  'Graphical
      TabIndex        =   13
      Top             =   3285
      Width           =   915
   End
   Begin VB.Frame Frame3 
      BackColor       =   &H00C0FFC0&
      Height          =   45
      Left            =   2160
      TabIndex        =   12
      Top             =   3015
      Width           =   3240
   End
   Begin VB.TextBox txtOkPass 
      BackColor       =   &H00FFFFFF&
      Height          =   270
      IMEMode         =   3  'DISABLE
      Left            =   2880
      MaxLength       =   15
      PasswordChar    =   "*"
      TabIndex        =   11
      Top             =   2655
      Width           =   2175
   End
   Begin VB.TextBox txtPass 
      BackColor       =   &H00FFFFFF&
      Height          =   270
      IMEMode         =   3  'DISABLE
      Left            =   2880
      MaxLength       =   15
      PasswordChar    =   "*"
      TabIndex        =   10
      Top             =   2175
      Width           =   2175
   End
   Begin VB.TextBox txtName 
      BackColor       =   &H00FFFFFF&
      Height          =   270
      Left            =   2880
      MaxLength       =   15
      TabIndex        =   0
      Top             =   1695
      Width           =   2175
   End
   Begin VB.Frame Frame2 
      BackColor       =   &H005CE764&
      ForeColor       =   &H00008000&
      Height          =   60
      Left            =   -30
      TabIndex        =   6
      Top             =   855
      Width           =   5640
   End
   Begin VB.Frame Frame1 
      BackColor       =   &H00E0E0E0&
      Caption         =   "管理员列表"
      Height          =   2535
      Left            =   45
      TabIndex        =   4
      Top             =   1155
      Width           =   2100
      Begin MSComctlLib.ListView Lv 
         Height          =   2055
         Left            =   120
         TabIndex        =   5
         Top             =   360
         Width           =   1830
         _ExtentX        =   3228
         _ExtentY        =   3625
         View            =   3
         LabelEdit       =   1
         LabelWrap       =   -1  'True
         HideSelection   =   -1  'True
         FullRowSelect   =   -1  'True
         GridLines       =   -1  'True
         _Version        =   393217
         ForeColor       =   -2147483640
         BackColor       =   -2147483643
         BorderStyle     =   1
         Appearance      =   1
         NumItems        =   1
         BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
            Text            =   "管理员"
            Object.Width           =   2540
         EndProperty
      End
   End
   Begin VB.PictureBox Picture1 
      BackColor       =   &H00D0D0D0&
      Height          =   900
      Left            =   -30
      ScaleHeight     =   840
      ScaleWidth      =   5430
      TabIndex        =   1
      Top             =   -30
      Width           =   5490
      Begin VB.Image Image1 
         Height          =   480
         Left            =   90
         Picture         =   "SetPer.frx":058A
         Top             =   330
         Width           =   480
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         BackColor       =   &H0080FFFF&
         BackStyle       =   0  'Transparent
         Caption         =   "=>单击右键显示菜单"
         ForeColor       =   &H00404040&
         Height          =   180
         Index           =   3
         Left            =   3465
         TabIndex        =   16
         Top             =   360
         Width           =   1620
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         BackColor       =   &H0080FFFF&
         BackStyle       =   0  'Transparent
         Caption         =   "=>双击列表可修改设置"
         ForeColor       =   &H00404040&
         Height          =   180
         Index           =   2
         Left            =   3465
         TabIndex        =   15
         Top             =   120
         Width           =   1800
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         BackColor       =   &H0080FFFF&
         BackStyle       =   0  'Transparent
         Caption         =   "=>输入各项之后按保存"
         ForeColor       =   &H00404040&
         Height          =   180
         Index           =   1
         Left            =   3465
         TabIndex        =   3
         Top             =   600
         Width           =   1800
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         BackColor       =   &H0080FFFF&
         BackStyle       =   0  'Transparent
         Caption         =   "管理员资料:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00800000&
         Height          =   210
         Index           =   0
         Left            =   585
         TabIndex        =   2
         Top             =   555
         Width           =   1260
      End
   End
   Begin VB.CommandButton CmdAdd 
      BackColor       =   &H00FFFFFF&
      Caption         =   "添加"
      Height          =   375
      Left            =   2415
      Style           =   1  'Graphical
      TabIndex        =   17
      Top             =   3285
      Width           =   885
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      BackColor       =   &H00E0E0E0&
      Caption         =   "重复"
      Height          =   180
      Index           =   2
      Left            =   2280
      TabIndex        =   9
      Top             =   2655
      Width           =   360
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      BackColor       =   &H00E0E0E0&
      Caption         =   "口令"
      Height          =   180
      Index           =   1
      Left            =   2280
      TabIndex        =   8
      Top             =   2175
      Width           =   360
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      BackColor       =   &H00E0E0E0&
      Caption         =   "姓名"
      Height          =   180
      Index           =   0
      Left            =   2280
      TabIndex        =   7
      Top             =   1695
      Width           =   360
   End
   Begin VB.Menu MainMnu 
      Caption         =   "MainMnu"
      Visible         =   0   'False
      Begin VB.Menu EditMnu 
         Caption         =   "修改"
      End
      Begin VB.Menu DeleteMnu 
         Caption         =   "删除(&D)"
      End
      Begin VB.Menu s2 
         Caption         =   "-"
      End
      Begin VB.Menu ExitMnu 
         Caption         =   "退出"
      End
   End
End
Attribute VB_Name = "SetPer"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim db As Database
Dim rst As Recordset
Dim Rec As Integer
Dim StrFlag As String

Private Sub CmdAdd_Click()
Dim NewName As String
NewName = InputBox("清在下面的文本框中填写想要添加的操作员的名字", "添加新操作员", "操作员1")
If NewName <> "" Then
    '检查是否有重复的操作员
    rst.MoveFirst
    Do While Not (rst.EOF Or rst.BOF)
        If rst("名称") = NewName Then
            MsgBox "该操作员已经存在!", , "不能添加"
            Exit Sub
        End If
        rst.MoveNext
    Loop
    rst.MoveLast
    rst.AddNew
    rst.Fields("名称") = NewName
    rst.Update
    '显示所有操作员的列表
    Disp
End If

End Sub

Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub cmdSave_Click()
On Err GoTo ErEnd
If StrFlag = "修改" Then
    rst.Seek "=", Lv.SelectedItem.Text
    If txtName.Text = "" Or txtPass.Text = "" Or txtOkPass = "" Then
    MsgBox "请将所有信息填写完整!", 0 + 16, "提示"
    Exit Sub
    End If
    If txtPass.Text <> txtOkPass.Text Then
    MsgBox "密码不相同!", 0 + 16, "密码"
    txtOkPass.SetFocus
    Exit Sub
    End If
    rst.Edit
    rst.Fields("名称") = txtName.Text
    rst.Fields("密码") = Trim(txtPass.Text)
    rst.Update
    Disp
    StrFlag = ""
    MsgBox "修改成功!", 0 + 48, "提示"
Else

If txtName.Text = "" Or txtPass.Text = "" Or txtOkPass = "" Then
    MsgBox "请将所有信息填写完整!", 0 + 16, "提示"
    Exit Sub
End If
If txtPass.Text <> txtOkPass.Text Then
    MsgBox "密码不相同!", 0 + 16, "密码"
    txtOkPass.SetFocus
    Exit Sub
End If
rst.AddNew
rst.Fields("名称") = txtName.Text
rst.Fields("密码") = Trim(txtPass.Text)
rst.Update
Disp
StrFlag = ""
MsgBox "添加成功!", 0 + 48, "提示"
End If
txtName.Text = ""
txtPass.Text = ""
txtOkPass.Text = ""
Exit Sub
ErEnd:
    MsgBox Err.Description, , "系统提示"
End Sub

Private Sub DeleteMnu_Click()
Dim Str As String
If Lv.SelectedItem.Text = "超级用户" Then
    MsgBox "超级用户不能删除!", 0 + 16, "错误"
    Exit Sub
End If
rst.Seek "=", Lv.SelectedItem.Text
Str = "确实要删除 " & Lv.SelectedItem.Text & "吗?"
If MsgBox(Str, 4 + 32, "删除") = vbYes Then
    rst.Delete
    Disp
End If
End Sub
Private Sub EditMnu_Click()
Lv_DblClick
End Sub

Private Sub Form_Load()
Set db = Workspaces(0).OpenDatabase(App.Path & "\Database\Data.mdb", False)
Set rst = db.OpenRecordset("Pass", dbOpenTable)
rst.Index = "名称"
Disp
End Sub
Private Sub Disp()
Lv.ListItems.Clear
rst.MoveLast
Rec = rst.RecordCount
rst.MoveFirst
For i = 1 To Rec
    Lv.ListItems.Add i, , rst.Fields("名称")
    rst.MoveNext
    If rst.EOF Then Exit Sub
Next
End Sub

Private Sub Form_Unload(Cancel As Integer)
rst.Close
db.Close
End Sub

Private Sub Lv_DblClick()
If Lv.SelectedItem.Text = "超级用户" Then
    MsgBox "超级用户不能修改!", 0 + 16, "错误"
    Exit Sub
End If
StrFlag = "修改"
txtName.Text = Lv.SelectedItem.Text
End Sub

Private Sub Lv_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then
    PopupMenu MainMnu
End If
End Sub

Private Sub txtName_Change()
If txtName.Text <> "" Then
    cmdSave.Enabled = True
Else
    cmdSave.Enabled = False
End If
End Sub

⌨️ 快捷键说明

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