📄 changepasswd.vb
字号:
Public Class ChaPasswd
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 Label1 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents tbOldPw As System.Windows.Forms.TextBox
Friend WithEvents tbNewPw1 As System.Windows.Forms.TextBox
Friend WithEvents tbNewPw2 As System.Windows.Forms.TextBox
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Label1 = New System.Windows.Forms.Label
Me.Label2 = New System.Windows.Forms.Label
Me.Label3 = New System.Windows.Forms.Label
Me.Button1 = New System.Windows.Forms.Button
Me.Button2 = New System.Windows.Forms.Button
Me.tbOldPw = New System.Windows.Forms.TextBox
Me.tbNewPw1 = New System.Windows.Forms.TextBox
Me.tbNewPw2 = New System.Windows.Forms.TextBox
Me.GroupBox1 = New System.Windows.Forms.GroupBox
Me.GroupBox1.SuspendLayout()
Me.SuspendLayout()
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(16, 32)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(72, 23)
Me.Label1.TabIndex = 0
Me.Label1.Text = "输入旧密码"
Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'Label2
'
Me.Label2.Location = New System.Drawing.Point(16, 88)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(72, 23)
Me.Label2.TabIndex = 1
Me.Label2.Text = "输入新密码"
Me.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'Label3
'
Me.Label3.Location = New System.Drawing.Point(16, 144)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(72, 23)
Me.Label3.TabIndex = 2
Me.Label3.Text = "确认新密码"
Me.Label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(48, 224)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 4
Me.Button1.Text = "确认"
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(168, 224)
Me.Button2.Name = "Button2"
Me.Button2.TabIndex = 5
Me.Button2.Text = "取消"
'
'tbOldPw
'
Me.tbOldPw.Location = New System.Drawing.Point(104, 32)
Me.tbOldPw.Name = "tbOldPw"
Me.tbOldPw.PasswordChar = Microsoft.VisualBasic.ChrW(42)
Me.tbOldPw.Size = New System.Drawing.Size(144, 21)
Me.tbOldPw.TabIndex = 6
Me.tbOldPw.Text = ""
'
'tbNewPw1
'
Me.tbNewPw1.Location = New System.Drawing.Point(104, 88)
Me.tbNewPw1.Name = "tbNewPw1"
Me.tbNewPw1.PasswordChar = Microsoft.VisualBasic.ChrW(42)
Me.tbNewPw1.Size = New System.Drawing.Size(144, 21)
Me.tbNewPw1.TabIndex = 7
Me.tbNewPw1.Text = ""
'
'tbNewPw2
'
Me.tbNewPw2.Location = New System.Drawing.Point(104, 144)
Me.tbNewPw2.Name = "tbNewPw2"
Me.tbNewPw2.PasswordChar = Microsoft.VisualBasic.ChrW(42)
Me.tbNewPw2.Size = New System.Drawing.Size(144, 21)
Me.tbNewPw2.TabIndex = 8
Me.tbNewPw2.Text = ""
'
'GroupBox1
'
Me.GroupBox1.Controls.Add(Me.tbNewPw2)
Me.GroupBox1.Controls.Add(Me.Label3)
Me.GroupBox1.Controls.Add(Me.tbNewPw1)
Me.GroupBox1.Controls.Add(Me.Label2)
Me.GroupBox1.Controls.Add(Me.tbOldPw)
Me.GroupBox1.Controls.Add(Me.Label1)
Me.GroupBox1.Location = New System.Drawing.Point(16, 8)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(264, 192)
Me.GroupBox1.TabIndex = 9
Me.GroupBox1.TabStop = False
'
'ChaPasswd
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(292, 273)
Me.Controls.Add(Me.GroupBox1)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.MaximizeBox = False
Me.Name = "ChaPasswd"
Me.Text = "修改密码"
Me.GroupBox1.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Close()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If tbOldPw.Text <> passwd Then
MsgBox("原密码错误!", , "")
Exit Sub
End If
If tbNewPw1.Text <> tbNewPw2.Text Then
MsgBox("确认密码与新密码不符!", , "")
Exit Sub
End If
If mycon.State = ConnectionState.Closed Then mycon.Open()
Dim str As String = "update password set password='" & tbNewPw1.Text & "' where ID='" & operid & "'"
Dim mycom As New SqlCommand(str, mycon)
mycom.ExecuteNonQuery()
MsgBox("密码修改成功!", , "")
passwd = tbNewPw1.Text
tbOldPw.Text = ""
tbNewPw1.Text = ""
tbNewPw2.Text = ""
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -