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

📄 frmchangepassword.frm

📁 本人用VB 6.0和ACCESS编写的图书管理系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmChangePassword 
   Caption         =   "修改密码"
   ClientHeight    =   4140
   ClientLeft      =   3615
   ClientTop       =   2415
   ClientWidth     =   4605
   Icon            =   "frmChangePassword.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4140
   ScaleWidth      =   4605
   StartUpPosition =   2  '屏幕中心
   Begin VB.TextBox txtOldPassword 
      Height          =   375
      IMEMode         =   3  'DISABLE
      Left            =   1800
      PasswordChar    =   "*"
      TabIndex        =   2
      Top             =   1080
      Width           =   2295
   End
   Begin VB.CommandButton cmdCancel 
      Cancel          =   -1  'True
      Caption         =   "取消(&C)"
      Height          =   375
      Left            =   2753
      TabIndex        =   8
      Top             =   3480
      Width           =   1335
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "确定(&O)"
      Default         =   -1  'True
      Height          =   375
      Left            =   593
      TabIndex        =   7
      Top             =   3480
      Width           =   1335
   End
   Begin VB.TextBox txtConfirm 
      Height          =   375
      IMEMode         =   3  'DISABLE
      Left            =   1800
      PasswordChar    =   "*"
      TabIndex        =   6
      Top             =   2760
      Width           =   2295
   End
   Begin VB.TextBox txtPassword 
      Height          =   375
      IMEMode         =   3  'DISABLE
      Left            =   1800
      PasswordChar    =   "*"
      TabIndex        =   3
      Top             =   1920
      Width           =   2295
   End
   Begin VB.TextBox txtName 
      Enabled         =   0   'False
      Height          =   375
      Left            =   1800
      TabIndex        =   0
      Top             =   240
      Width           =   2295
   End
   Begin VB.Label Label4 
      AutoSize        =   -1  'True
      Caption         =   "旧密码(&P):"
      Height          =   180
      Left            =   480
      TabIndex        =   9
      Top             =   1170
      Width           =   900
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "人员姓名(&N):"
      Height          =   180
      Left            =   480
      TabIndex        =   5
      Top             =   330
      Width           =   1080
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      Caption         =   "确认密码(&C):"
      Height          =   180
      Left            =   480
      TabIndex        =   4
      Top             =   2850
      Width           =   1080
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "输入密码(&N):"
      Height          =   180
      Left            =   480
      TabIndex        =   1
      Top             =   2010
      Width           =   1080
   End
End
Attribute VB_Name = "frmChangePassword"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim ws As Workspace, db As Database, rs As Recordset
Dim strOldPassword As String * 20, strPassword As String * 20, strPasswordConfirm As String * 20

Private Sub cmdCancel_Click()
    Unload Me
End Sub

Private Sub cmdOK_Click()
    '处理密码文本框
    If Trim(OperatorPassword) <> "" Then
        If txtOldPassword.Text = "" Or txtPassword.Text = "" Or txtConfirm.Text = "" Then
            MsgBox "请输入密码!", vbExclamation + vbOKOnly, "修改密码"
            txtOldPassword.SetFocus
            SendKeys "{Home}+{End}"
            Exit Sub
        End If
    End If
    strOldPassword = txtOldPassword.Text
    strPassword = txtPassword.Text
    strPasswordConfirm = txtConfirm.Text
    '判断输入是否正确
    If strOldPassword = OperatorPassword And strPassword = strPasswordConfirm Then
        '向数据库中写入密码
        Set ws = DBEngine.Workspaces(0)
        Set db = ws.OpenDatabase(App.Path + "\人员库.mdb", False, False)
        Set rs = db.OpenRecordset("人员表")
        rs.MoveFirst
        rs.Move OperatorIndex - 1
        rs.Edit
        rs.Fields("密码") = Trim(strPassword)
        rs.Update
        '关闭数据库
        rs.Close
        db.Close
        ws.Close
        Set rs = Nothing
        Set db = Nothing
        Set ws = Nothing
        MsgBox "修改密码成功!", vbInformation + vbOKOnly, "修改密码"
    Else
        MsgBox "密码不正确!", vbExclamation + vbOKOnly, "修改密码"
        txtOldPassword.SetFocus
        SendKeys "{Home}+{End}"
        Exit Sub
    End If
    Unload Me
End Sub

Private Sub Form_Load()
    txtName.Text = OperatorName
End Sub

⌨️ 快捷键说明

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