📄 modifypassword.vb
字号:
Public Class frmModifyPassword
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 Label1 As System.Windows.Forms.Label
Friend WithEvents txtOldPass As System.Windows.Forms.TextBox
Friend WithEvents txtNewPass As System.Windows.Forms.TextBox
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents txtConfirmPass As System.Windows.Forms.TextBox
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents btnModify As System.Windows.Forms.Button
Friend WithEvents btnClose As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.GroupBox1 = New System.Windows.Forms.GroupBox
Me.txtOldPass = New System.Windows.Forms.TextBox
Me.Label1 = New System.Windows.Forms.Label
Me.txtNewPass = New System.Windows.Forms.TextBox
Me.Label2 = New System.Windows.Forms.Label
Me.txtConfirmPass = New System.Windows.Forms.TextBox
Me.Label3 = New System.Windows.Forms.Label
Me.btnModify = New System.Windows.Forms.Button
Me.btnClose = New System.Windows.Forms.Button
Me.GroupBox1.SuspendLayout()
Me.SuspendLayout()
'
'GroupBox1
'
Me.GroupBox1.Controls.Add(Me.txtOldPass)
Me.GroupBox1.Controls.Add(Me.Label1)
Me.GroupBox1.Controls.Add(Me.txtNewPass)
Me.GroupBox1.Controls.Add(Me.Label2)
Me.GroupBox1.Controls.Add(Me.txtConfirmPass)
Me.GroupBox1.Controls.Add(Me.Label3)
Me.GroupBox1.Location = New System.Drawing.Point(16, 16)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(224, 152)
Me.GroupBox1.TabIndex = 0
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "修改密码"
'
'txtOldPass
'
Me.txtOldPass.Location = New System.Drawing.Point(72, 32)
Me.txtOldPass.Name = "txtOldPass"
Me.txtOldPass.PasswordChar = Microsoft.VisualBasic.ChrW(42)
Me.txtOldPass.Size = New System.Drawing.Size(128, 21)
Me.txtOldPass.TabIndex = 0
Me.txtOldPass.Text = ""
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(8, 32)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(56, 23)
Me.Label1.TabIndex = 0
Me.Label1.Text = "旧密码"
'
'txtNewPass
'
Me.txtNewPass.Location = New System.Drawing.Point(72, 72)
Me.txtNewPass.Name = "txtNewPass"
Me.txtNewPass.PasswordChar = Microsoft.VisualBasic.ChrW(42)
Me.txtNewPass.Size = New System.Drawing.Size(128, 21)
Me.txtNewPass.TabIndex = 1
Me.txtNewPass.Text = ""
'
'Label2
'
Me.Label2.Location = New System.Drawing.Point(8, 72)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(56, 23)
Me.Label2.TabIndex = 0
Me.Label2.Text = "新密码"
'
'txtConfirmPass
'
Me.txtConfirmPass.Location = New System.Drawing.Point(72, 112)
Me.txtConfirmPass.Name = "txtConfirmPass"
Me.txtConfirmPass.PasswordChar = Microsoft.VisualBasic.ChrW(42)
Me.txtConfirmPass.Size = New System.Drawing.Size(128, 21)
Me.txtConfirmPass.TabIndex = 2
Me.txtConfirmPass.Text = ""
'
'Label3
'
Me.Label3.Location = New System.Drawing.Point(8, 112)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(56, 23)
Me.Label3.TabIndex = 0
Me.Label3.Text = "确认"
'
'btnModify
'
Me.btnModify.Location = New System.Drawing.Point(16, 184)
Me.btnModify.Name = "btnModify"
Me.btnModify.Size = New System.Drawing.Size(56, 32)
Me.btnModify.TabIndex = 1
Me.btnModify.Text = "修改"
'
'btnClose
'
Me.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.btnClose.Location = New System.Drawing.Point(184, 184)
Me.btnClose.Name = "btnClose"
Me.btnClose.Size = New System.Drawing.Size(56, 32)
Me.btnClose.TabIndex = 2
Me.btnClose.Text = "关闭"
'
'frmModifyPassword
'
Me.AcceptButton = Me.btnModify
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.CancelButton = Me.btnClose
Me.ClientSize = New System.Drawing.Size(256, 221)
Me.Controls.Add(Me.btnModify)
Me.Controls.Add(Me.GroupBox1)
Me.Controls.Add(Me.btnClose)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
Me.MaximizeBox = False
Me.Name = "frmModifyPassword"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "登录密码修改"
Me.GroupBox1.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub btnModify_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnModify.Click
If txtOldPass.Text <> Password Then
MsgBox("密码错误")
txtOldPass.Text = ""
txtNewPass.Text = ""
txtConfirmPass.Text = ""
txtOldPass.Focus()
ElseIf txtNewPass.Text <> txtConfirmPass.Text Then
MsgBox("两次密码不一致,请重新输入新密码")
txtNewPass.Text = ""
txtConfirmPass.Text = ""
txtNewPass.Focus()
Else
Try
Dim str As String = "update 管理员 set logpwd='" & txtNewPass.Text & _
"' where logname='" & UserName & "'"
If OleConn.UpdateQuery(str) Then
MsgBox("修改密码成功")
Password = txtNewPass.Text
txtOldPass.Text = ""
txtNewPass.Text = ""
txtConfirmPass.Text = ""
txtOldPass.Focus()
Else
MsgBox("修改密码失败")
End If
Catch ex As Exception
OleConn.DisplayError(ex)
End Try
End If
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -