?? 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(272, 168)
Me.GroupBox1.TabIndex = 0
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "修改密碼"
'
'txtOldPass
'
Me.txtOldPass.Location = New System.Drawing.Point(96, 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(24, 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(96, 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(24, 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(96, 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(16, 112)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(72, 23)
Me.Label3.TabIndex = 0
Me.Label3.Text = "重新輸入"
'
'btnModify
'
Me.btnModify.Location = New System.Drawing.Point(32, 200)
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(200, 200)
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(306, 250)
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
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
End Sub
End Class
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -