📄 frmchangepassword.frm
字号:
VERSION 5.00
Begin VB.Form ChangePassword
BorderStyle = 1 'Fixed Single
Caption = "修改登录口令"
ClientHeight = 1980
ClientLeft = 45
ClientTop = 330
ClientWidth = 3645
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 1980
ScaleWidth = 3645
Begin VB.TextBox txtOldPWD
DataSource = "Adodc1"
Height = 270
Left = 960
Locked = -1 'True
MaxLength = 6
TabIndex = 4
TabStop = 0 'False
Top = 240
Width = 1935
End
Begin VB.TextBox txtNewPWD
Height = 270
Index = 1
Left = 960
MaxLength = 6
TabIndex = 1
Top = 960
Width = 1935
End
Begin VB.TextBox txtNewPWD
Height = 270
Index = 0
Left = 960
MaxLength = 6
TabIndex = 0
Top = 630
Width = 1935
End
Begin VB.CommandButton cmdSave
Caption = "保存"
Default = -1 'True
Height = 300
Left = 795
TabIndex = 2
Top = 1425
Width = 735
End
Begin VB.CommandButton cmdExit
Cancel = -1 'True
Caption = "关闭"
Height = 300
Left = 1995
TabIndex = 3
Top = 1425
Width = 735
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "新口令"
Height = 180
Left = 360
TabIndex = 6
Top = 660
Width = 540
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "旧口令"
Height = 180
Left = 360
TabIndex = 5
Top = 285
Width = 540
End
End
Attribute VB_Name = "ChangePassword"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdExit_Click()
Unload Me '关闭口令修改窗体
End Sub
Private Sub cmdSave_Click()
If txtNewPWD(1) <> txtNewPWD(0) Then '验证两次输入的新口令是否相同
MsgBox "两次输入的新口令必须相等!", vbExclamation, "修改口令"
txtNewPWD(0).SetFocus
txtNewPWD(0).SelStart = 0
txtNewPWD(0).SelLength = Len(txtNewPWD(0))
Else '修改原来的口令
With Drug_Store.rsSysUsers
.Open
.Find "编号='" & CurrentUserNumber & "'"
.Fields("口令") = Trim(txtNewPWD(0))
.Update
End With
MsgBox "口令以被成功修改!", vbInformation, "修改口令"
End If
End Sub
Private Sub txtNewPWD_KeyPress(Index As Integer, KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
SendKeys "{Tab}" '敲的是回车键,使下一个控件获得焦点
ElseIf Not (KeyAscii >= vbKey0 And KeyAscii <= vbKey9 _
Or KeyAscii >= Asc("a") And KeyAscii <= Asc("z") _
Or KeyAscii >= Asc("A") And KeyAscii <= Asc("Z") _
Or KeyAscii = vbKeyBack) Then
KeyAscii = 0 '输入不是数字、英文字母或退格键,取消输入
End If
End Sub
Private Sub Form_Load()
txtOldPWD = CurrentUserPassword '显示用户口令
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -