frmchangepwd.vb

来自「这个是本人写的题库系统,开发工具是vb.net.试题编辑,试卷编辑,可以在wor」· VB 代码 · 共 247 行

VB
247
字号
Public Class frmchangepwd
    Inherits System.Windows.Forms.Form

#Region " Windows 窗体设计器生成的代码 "

    Public Sub New()
        MyBase.New()

        '该调用是 Windows 窗体设计器所必需的。
        InitializeComponent()

        '在 InitializeComponent() 调用之后添加任何初始化

    End Sub

    '窗体重写 dispose 以清理组件列表。
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Windows 窗体设计器所必需的
    Private components As System.ComponentModel.IContainer

    '注意: 以下过程是 Windows 窗体设计器所必需的
    '可以使用 Windows 窗体设计器修改此过程。
    '不要使用代码编辑器修改它。
    Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents txt_name As System.Windows.Forms.TextBox
    Friend WithEvents Label4 As System.Windows.Forms.Label
    Friend WithEvents cmd_ok As System.Windows.Forms.Button
    Friend WithEvents cmd_cancel As System.Windows.Forms.Button
    Friend WithEvents txt_chkpwd As System.Windows.Forms.TextBox
    Friend WithEvents txt_pwd As System.Windows.Forms.TextBox
    Friend WithEvents txt_oldpwd As System.Windows.Forms.TextBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmchangepwd))
        Me.GroupBox1 = New System.Windows.Forms.GroupBox
        Me.txt_chkpwd = New System.Windows.Forms.TextBox
        Me.txt_pwd = New System.Windows.Forms.TextBox
        Me.txt_oldpwd = New System.Windows.Forms.TextBox
        Me.Label4 = New System.Windows.Forms.Label
        Me.Label3 = New System.Windows.Forms.Label
        Me.Label2 = New System.Windows.Forms.Label
        Me.Label1 = New System.Windows.Forms.Label
        Me.txt_name = New System.Windows.Forms.TextBox
        Me.cmd_ok = New System.Windows.Forms.Button
        Me.cmd_cancel = New System.Windows.Forms.Button
        Me.GroupBox1.SuspendLayout()
        Me.SuspendLayout()
        '
        'GroupBox1
        '
        Me.GroupBox1.Controls.Add(Me.txt_chkpwd)
        Me.GroupBox1.Controls.Add(Me.txt_pwd)
        Me.GroupBox1.Controls.Add(Me.txt_oldpwd)
        Me.GroupBox1.Controls.Add(Me.Label4)
        Me.GroupBox1.Controls.Add(Me.Label3)
        Me.GroupBox1.Controls.Add(Me.Label2)
        Me.GroupBox1.Controls.Add(Me.Label1)
        Me.GroupBox1.Controls.Add(Me.txt_name)
        Me.GroupBox1.Location = New System.Drawing.Point(16, 8)
        Me.GroupBox1.Name = "GroupBox1"
        Me.GroupBox1.Size = New System.Drawing.Size(256, 168)
        Me.GroupBox1.TabIndex = 0
        Me.GroupBox1.TabStop = False
        '
        'txt_chkpwd
        '
        Me.txt_chkpwd.Location = New System.Drawing.Point(98, 138)
        Me.txt_chkpwd.MaxLength = 20
        Me.txt_chkpwd.Name = "txt_chkpwd"
        Me.txt_chkpwd.PasswordChar = Microsoft.VisualBasic.ChrW(42)
        Me.txt_chkpwd.Size = New System.Drawing.Size(128, 21)
        Me.txt_chkpwd.TabIndex = 17
        Me.txt_chkpwd.Text = ""
        '
        'txt_pwd
        '
        Me.txt_pwd.Location = New System.Drawing.Point(98, 104)
        Me.txt_pwd.MaxLength = 20
        Me.txt_pwd.Name = "txt_pwd"
        Me.txt_pwd.PasswordChar = Microsoft.VisualBasic.ChrW(42)
        Me.txt_pwd.Size = New System.Drawing.Size(128, 21)
        Me.txt_pwd.TabIndex = 16
        Me.txt_pwd.Text = ""
        '
        'txt_oldpwd
        '
        Me.txt_oldpwd.Location = New System.Drawing.Point(98, 64)
        Me.txt_oldpwd.MaxLength = 20
        Me.txt_oldpwd.Name = "txt_oldpwd"
        Me.txt_oldpwd.PasswordChar = Microsoft.VisualBasic.ChrW(42)
        Me.txt_oldpwd.Size = New System.Drawing.Size(128, 21)
        Me.txt_oldpwd.TabIndex = 15
        Me.txt_oldpwd.Text = ""
        '
        'Label4
        '
        Me.Label4.Location = New System.Drawing.Point(24, 68)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(56, 16)
        Me.Label4.TabIndex = 14
        Me.Label4.Text = "旧口令:"
        '
        'Label3
        '
        Me.Label3.Location = New System.Drawing.Point(24, 141)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(72, 16)
        Me.Label3.TabIndex = 12
        Me.Label3.Text = "确认口令:"
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(24, 106)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(64, 16)
        Me.Label2.TabIndex = 10
        Me.Label2.Text = "新口令:"
        '
        'Label1
        '
        Me.Label1.Location = New System.Drawing.Point(24, 32)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(72, 17)
        Me.Label1.TabIndex = 8
        Me.Label1.Text = "用户名称:"
        '
        'txt_name
        '
        Me.txt_name.Enabled = False
        Me.txt_name.Location = New System.Drawing.Point(98, 24)
        Me.txt_name.MaxLength = 20
        Me.txt_name.Name = "txt_name"
        Me.txt_name.Size = New System.Drawing.Size(128, 21)
        Me.txt_name.TabIndex = 7
        Me.txt_name.Text = ""
        '
        'cmd_ok
        '
        Me.cmd_ok.FlatStyle = System.Windows.Forms.FlatStyle.Flat
        Me.cmd_ok.Location = New System.Drawing.Point(40, 192)
        Me.cmd_ok.Name = "cmd_ok"
        Me.cmd_ok.Size = New System.Drawing.Size(80, 32)
        Me.cmd_ok.TabIndex = 1
        Me.cmd_ok.Text = "确   定"
        '
        'cmd_cancel
        '
        Me.cmd_cancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat
        Me.cmd_cancel.Location = New System.Drawing.Point(168, 192)
        Me.cmd_cancel.Name = "cmd_cancel"
        Me.cmd_cancel.Size = New System.Drawing.Size(80, 32)
        Me.cmd_cancel.TabIndex = 2
        Me.cmd_cancel.Text = "取   消"
        '
        'frmchangepwd
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(288, 237)
        Me.Controls.Add(Me.cmd_cancel)
        Me.Controls.Add(Me.cmd_ok)
        Me.Controls.Add(Me.GroupBox1)
        Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
        Me.MaximizeBox = False
        Me.Name = "frmchangepwd"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "更改密码"
        Me.GroupBox1.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub cmd_ok_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles cmd_ok.MouseMove
        cmd_ok.BackColor = System.Drawing.SystemColors.ControlLight
    End Sub

    Private Sub cmd_ok_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmd_ok.MouseLeave
        cmd_ok.BackColor = System.Drawing.SystemColors.Control
    End Sub

    Private Sub cmd_cancel_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmd_cancel.MouseLeave
        cmd_cancel.BackColor = System.Drawing.SystemColors.Control
    End Sub

    Private Sub cmd_cancel_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles cmd_cancel.MouseMove
        cmd_cancel.BackColor = System.Drawing.SystemColors.ControlLight
    End Sub

    Private Sub cmd_cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd_cancel.Click
        Me.Close()
    End Sub

    Private Sub cmd_ok_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd_ok.Click
        If Trim(txt_oldpwd.Text) = "" Then
            MsgBox("旧口令不能为空", MsgBoxStyle.Exclamation, "翼清测试题库系统V1.0")
            txt_oldpwd.Focus()
            Exit Sub
        End If
        If Trim(txt_pwd.Text) = "" Then
            MsgBox("口令不能为空", MsgBoxStyle.Exclamation, "翼清测试题库系统V1.0")
            txt_pwd.Focus()
            Exit Sub
        End If
        If Trim(txt_chkpwd.Text) = "" Then
            MsgBox("确认口令不能为空", MsgBoxStyle.Exclamation, "翼清测试题库系统V1.0")
            txt_chkpwd.Focus()
            Exit Sub
        End If
        If Trim(txt_chkpwd.Text) <> Trim(txt_pwd.Text) Then
            MsgBox("确认口令与口令不相符", MsgBoxStyle.Exclamation, "翼清测试题库系统V1.0")
            txt_pwd.Text = ""
            txt_chkpwd.Text = ""
            txt_pwd.Focus()
            Exit Sub
        End If
        If MyUser.CheckUser(CurUser.UserName, CurUser.UserType, MakeStr(txt_oldpwd.Text)) = False Then
            MsgBox("输入旧口令与当前用户密码不相符,请确认", MsgBoxStyle.Exclamation, "翼清测试题库系统V1.0")
            txt_oldpwd.Text = ""
            txt_oldpwd.Focus()
            Exit Sub
        Else
            MyUser.UserPassWord = MakeStr(txt_pwd.Text)
            MyUser.Modify()
            CurUser.UserPassWord = MyUser.UserPassWord
            txt_oldpwd.Enabled = False
            txt_pwd.Enabled = False
            txt_chkpwd.Enabled = False
            cmd_ok.Enabled = False
        End If
    End Sub

    Private Sub frmchangepwd_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        txt_name.Text = CurUser.UserName
    End Sub
End Class

⌨️ 快捷键说明

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