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

📄 frmchangepassword.frm

📁 Visual basic + sql server2000学员管理系统原代码
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmChangePassword 
   Caption         =   "密码修改窗口"
   ClientHeight    =   3120
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   2985
   Icon            =   "frmChangePassword.frx":0000
   LinkTopic       =   "Form1"
   MDIChild        =   -1  'True
   ScaleHeight     =   3120
   ScaleWidth      =   2985
   Begin VB.TextBox txtChange 
      Height          =   300
      IMEMode         =   3  'DISABLE
      Left            =   1545
      PasswordChar    =   "*"
      TabIndex        =   2
      Top             =   1260
      Width           =   1215
   End
   Begin VB.CommandButton cmdSave 
      Caption         =   "确定"
      Height          =   375
      Left            =   478
      Style           =   1  'Graphical
      TabIndex        =   5
      Top             =   2400
      Width           =   800
   End
   Begin VB.CommandButton cmdExit 
      Caption         =   "退出"
      Height          =   375
      Left            =   1706
      Style           =   1  'Graphical
      TabIndex        =   6
      Top             =   2400
      Width           =   800
   End
   Begin VB.TextBox txtPassword 
      Height          =   300
      IMEMode         =   3  'DISABLE
      Left            =   1545
      PasswordChar    =   "*"
      TabIndex        =   1
      Top             =   760
      Width           =   1215
   End
   Begin VB.TextBox txtUserName 
      Height          =   300
      Left            =   1545
      TabIndex        =   0
      Top             =   260
      Width           =   1215
   End
   Begin VB.TextBox txtConfirm 
      Height          =   300
      IMEMode         =   3  'DISABLE
      Left            =   1545
      PasswordChar    =   "*"
      TabIndex        =   4
      Top             =   1760
      Width           =   1215
   End
   Begin VB.Label lblChange 
      Alignment       =   2  'Center
      Caption         =   "修改密码"
      Height          =   375
      Left            =   225
      TabIndex        =   9
      Top             =   1300
      Width           =   975
   End
   Begin VB.Label lblUserName 
      Alignment       =   2  'Center
      Caption         =   "用户名"
      Height          =   375
      Left            =   225
      TabIndex        =   8
      Top             =   300
      Width           =   975
   End
   Begin VB.Label lblPassword 
      Alignment       =   2  'Center
      Caption         =   "密  码"
      Height          =   375
      Left            =   225
      TabIndex        =   7
      Top             =   840
      Width           =   975
   End
   Begin VB.Label lblConfirm 
      Alignment       =   2  'Center
      Caption         =   "密码确认"
      Height          =   375
      Left            =   225
      TabIndex        =   3
      Top             =   1800
      Width           =   975
   End
End
Attribute VB_Name = "frmChangePassword"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub cmdExit_Click()
'关闭记录集,RsClose函数 见模块MdlConnection
RsClose rs
'关闭窗体
Unload Me
End Sub

Private Sub cmdSave_Click()

'比较用户密码和输入的密码
If StrComp(strPassword, txtPassword, vbBinaryCompare) <> 0 Then
    MsgBox "请输入正确的原密码!", vbOKOnly + vbExclamation, "提示"
    Exit Sub
Else
    '修改的密码不能为空,也不能大于20个字符
    If Len(Trim(txtChange.Text)) = 0 Or Len(Trim(txtChange.Text)) > 20 Then
        MsgBox "密码不能为空" & Chr(10) & "也不能大于20个字符!", vbOKOnly + vbExclamation, "提示"
        Exit Sub
    Else
        '比较修改的密码和确认密码
        If StrComp(txtChange.Text, txtConfirm.Text) <> 0 Then
            MsgBox "确认密码与修改密码不符" & Chr(10) & "请重新输入!", vbOKOnly + vbExclamation, "提示"
            Exit Sub
        Else
            '修改记录
            With rs
                rs.Fields("password") = Trim(txtChange.Text)
                .Update
                strPassword = Trim(txtChange.Text)
            End With
            txtPassword.Text = ""
            txtChange.Text = ""
            txtConfirm.Text = ""
        End If
    End If
End If

End Sub

Private Sub Form_Activate()
'窗体激活时设置焦点
txtPassword.SetFocus

RsClose rs
strFind = "select sysuser.*  from sysuser where username='" & strUserName & "' and password='" & strPassword & "'"
'打开表SysUser,创建记录集
RsOpen rs, con, strFind, "adcmdtext"

txtUserName.Enabled = False
txtUserName.Text = rs.Fields("username")
End Sub

Private Sub Form_Load()

'设置窗体的背景色为GetColor函数的返回值,宽度3400,GetColor函数 见模块MdlSystem
Me.BackColor = GetColor
Me.Width = 3100
Me.Height = 3500


'遍历窗体上的所有控件,改变颜色为GetColor函数的返回值(GetColor函数 见模块MdlSystem)
Dim ctlcontrol As Control
For Each ctlcontrol In Controls
    ctlcontrol.BackColor = GetColor
    ctlcontrol.FontSize = 10
Next



RsClose rs
strFind = "select sysuser.*  from sysuser where username='" & strUserName & "' and password='" & strPassword & "'"
'打开表SysUser,创建记录集
RsOpen rs, con, strFind, "adcmdtext"

txtUserName.Enabled = False
txtUserName.Text = rs.Fields("username")
End Sub

Private Sub Form_LostFocus()
'关闭记录集,RsClose函数 见模块MdlConnection
RsClose rs
End Sub

Private Sub Form_Unload(Cancel As Integer)
'关闭记录集,RsClose函数 见模块MdlConnection
RsClose rs
End Sub

⌨️ 快捷键说明

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