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

📄 changepwdfrm.frm

📁 很好的学习资料
💻 FRM
字号:
VERSION 5.00
Begin VB.Form changepwdfrm 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "修改密码"
   ClientHeight    =   2085
   ClientLeft      =   4935
   ClientTop       =   4485
   ClientWidth     =   2490
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2085
   ScaleWidth      =   2490
   Begin VB.CommandButton Command2 
      Caption         =   "放弃"
      Height          =   255
      Left            =   1320
      TabIndex        =   7
      Top             =   1800
      Width           =   855
   End
   Begin VB.CommandButton Command1 
      Caption         =   "修改"
      Height          =   255
      Left            =   240
      TabIndex        =   6
      Top             =   1800
      Width           =   855
   End
   Begin VB.TextBox renewpwdtxt 
      Height          =   270
      IMEMode         =   3  'DISABLE
      Left            =   1080
      PasswordChar    =   "*"
      TabIndex        =   5
      Top             =   1305
      Width           =   1335
   End
   Begin VB.TextBox newpwdtxt 
      Height          =   270
      IMEMode         =   3  'DISABLE
      Left            =   1080
      PasswordChar    =   "*"
      TabIndex        =   4
      Top             =   720
      Width           =   1335
   End
   Begin VB.TextBox oldpwdtxt 
      Height          =   270
      IMEMode         =   3  'DISABLE
      Left            =   1080
      PasswordChar    =   "*"
      TabIndex        =   3
      Top             =   120
      Width           =   1335
   End
   Begin VB.Label renewpwdlab 
      Caption         =   "重输确认"
      Height          =   375
      Left            =   120
      TabIndex        =   2
      Top             =   1320
      Width           =   855
   End
   Begin VB.Label newpwdlab 
      Caption         =   "新密码"
      Height          =   375
      Left            =   120
      TabIndex        =   1
      Top             =   720
      Width           =   855
   End
   Begin VB.Label oldpwdlab 
      Caption         =   "原来密码"
      Height          =   375
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   855
   End
End
Attribute VB_Name = "changepwdfrm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
    '  修改密码
    Private Sub Command1_Click()
        Dim idinfo As Recordset
        Dim sqlstr As String
        Dim changeable As Boolean
        
        If oldpwdtxt.Text <> "" And newpwdtxt.Text <> "" And (newpwdtxt.Text = renewpwdtxt.Text) Then
           '  如果密码非空,且新密码的两次键入相一致,则标记changeable为真
           changeable = True
        Else
           MsgBox "请重新输入新旧密码,并确保新密码的两次输入一致", vbOKOnly, "修改密码出错"
           '  清空各文本框,以便重新输入
           oldpwdtxt.Text = ""
           newpwdtxt.Text = ""
           renewpwdtxt.Text = ""
           oldpwdtxt.SetFocus
        End If
        
        If changeable Then
            sqlstr = "select 密码 from 密码 where 学号='" & ID & "'"
            Set idinfo = courseDB.OpenRecordset(sqlstr, dbOpenDynaset)  '打开记录集,以备修改
            If (idinfo.Fields("密码").Value = oldpwdtxt.Text) Then   '如果旧密码正确,则修改密码
                '  更新密码
                With idinfo
                    .Edit
                    !密码 = newpwdtxt.Text
                    .Update
                    .Bookmark = .LastModified
                End With
                MsgBox "密码修改成功", vbOKOnly, "成功"
                Unload changepwdfrm '退出窗体
            Else  '就秘码错误,提示重新输入
                MsgBox "密码错误,请重试!", vbOKOnly, "修改密码出错"
                 '  清空各文本框,以便重新输入
                oldpwdtxt.Text = ""
                newpwdtxt.Text = ""
                renewpwdtxt.Text = ""
                oldpwdtxt.SetFocus
           End If
           idinfo.Close  '关闭记录集
        End If
    End Sub
    
    '   放弃修改
    Private Sub Command2_Click()
        Unload changepwdfrm  '退出窗体
    End Sub

⌨️ 快捷键说明

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