📄 frmchangpassword.frm
字号:
VERSION 5.00
Begin VB.Form FrmChangPassword
BorderStyle = 1 'Fixed Single
Caption = "更改用户密码"
ClientHeight = 3195
ClientLeft = 45
ClientTop = 330
ClientWidth = 4680
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 3195
ScaleWidth = 4680
Begin VB.CommandButton CmdExit
Caption = "退出"
Height = 375
Left = 3000
TabIndex = 4
Top = 2400
Width = 975
End
Begin VB.CommandButton CmdOK
Caption = "确定"
Height = 375
Left = 1560
TabIndex = 3
Top = 2400
Width = 975
End
Begin VB.Data Datchange
Caption = "Data1"
Connect = "Access"
DatabaseName = ""
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 345
Left = 480
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = ""
Top = 2520
Visible = 0 'False
Width = 1335
End
Begin VB.TextBox TxtOldPassword
Height = 375
IMEMode = 3 'DISABLE
Left = 1920
PasswordChar = "*"
TabIndex = 0
Top = 600
Width = 1815
End
Begin VB.TextBox TxtPassword
Height = 375
IMEMode = 3 'DISABLE
Left = 1920
PasswordChar = "*"
TabIndex = 1
Top = 1200
Width = 1815
End
Begin VB.TextBox TxtPasswordCheck
Height = 375
IMEMode = 3 'DISABLE
Left = 1920
PasswordChar = "*"
TabIndex = 2
Top = 1800
Width = 1815
End
Begin VB.Label Label1
Caption = "原密码:"
Height = 375
Left = 960
TabIndex = 7
Top = 720
Width = 855
End
Begin VB.Label Label3
Caption = "验证密码:"
Height = 375
Left = 960
TabIndex = 6
Top = 1800
Width = 975
End
Begin VB.Label Label2
Caption = "新密码:"
Height = 375
Left = 960
TabIndex = 5
Top = 1320
Width = 735
End
End
Attribute VB_Name = "FrmChangPassword"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'************************************************************************
'本窗本用于更改用户的密码,要求更重新输入密码
'*************************************************************************
Dim intcount As Integer
Private Sub CmdExit_Click()
Unload Me
End Sub
Private Sub CmdOK_Click()
Dim rs As Recordset
If TxtOldPassword = "" Or TxtPassword = "" Or TxtPasswordCheck = "" Then
MsgBox "请将信息填完整!", vbOKOnly + vbExclamation, "增添用户"
End If
If intcount >= 3 Then
MsgBox "非法用户!", vbOKOnly + vbExclamation, ""
Unload Me
Exit Sub
End If
If TxtOldPassword <> userPassword Then
MsgBox "用户密码不正确!", vbOKOnly + vbExclamation, ""
intcount = intcount + 1
Exit Sub
End If
If TxtPassword.Text <> TxtPasswordCheck.Text Then
MsgBox "两次密码输入不一致", vbOKOnly + vbInformation, "增添用户"
Exit Sub
End If
Datchange.DatabaseName = DataPath
Datchange.RecordSource = "select * from usertable"
Datchange.Refresh
Set rs = Datchange.Recordset
With rs
.FindFirst "username = '" & username & "'"
.Edit
.Fields("password") = TxtPassword.Text
.Update
End With
MsgBox "密码修改成功!", vbOKCancel, "修改密码"
End Sub
Private Sub Form_Activate()
TxtOldPassword.SetFocus
End Sub
Private Sub Form_Load()
Me.Left = (Screen.Width - Me.ScaleWidth) * 1 / 2
Me.Top = (Screen.Height - Me.ScaleHeight) * 1 / 2
End Sub
Private Sub TxtOldPassword_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TxtPassword.SetFocus
End If
End Sub
Private Sub TxtPassword_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
TxtPasswordCheck.SetFocus
End If
End Sub
Private Sub TxtPasswordCheck_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
CmdOK_Click
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -