📄 frmsystempwd.frm
字号:
VERSION 5.00
Object = "{E95A2510-F3D1-416D-823B-4F840FE98091}#3.0#0"; "Command.ocx"
Begin VB.Form frmSystemPwd
BorderStyle = 3 'Fixed Dialog
Caption = "更改密码"
ClientHeight = 2475
ClientLeft = 45
ClientTop = 435
ClientWidth = 3765
ControlBox = 0 'False
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 2475
ScaleWidth = 3765
ShowInTaskbar = 0 'False
Visible = 0 'False
Begin VB.TextBox txtOldPwd
Height = 270
IMEMode = 3 'DISABLE
Left = 1560
MaxLength = 15
PasswordChar = "*"
TabIndex = 1
ToolTipText = "输入旧密码"
Top = 960
Width = 1575
End
Begin CSCommand.Command cmdSave
Default = -1 'True
Height = 255
Left = 960
TabIndex = 4
Top = 2100
Width = 735
_ExtentX = 1296
_ExtentY = 450
IconAlign = 0
Icon = "frmSystemPwd.frx":0000
Caption = "保存(&S)"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.TextBox txtUser
BackColor = &H8000000F&
Height = 270
Left = 1560
Locked = -1 'True
TabIndex = 6
Top = 600
Width = 1575
End
Begin VB.TextBox txtRepwd
Height = 270
IMEMode = 3 'DISABLE
Left = 1560
MaxLength = 15
PasswordChar = "*"
TabIndex = 3
ToolTipText = "重复输入15位新密码"
Top = 1680
Width = 1575
End
Begin VB.TextBox txtNewPwd
Height = 270
IMEMode = 3 'DISABLE
Left = 1560
MaxLength = 15
PasswordChar = "*"
TabIndex = 2
ToolTipText = "输入15位新密码"
Top = 1320
Width = 1575
End
Begin CSCommand.Command cmdCancel
Height = 255
Left = 2160
TabIndex = 5
Top = 2100
Width = 735
_ExtentX = 1296
_ExtentY = 450
IconAlign = 0
Icon = "frmSystemPwd.frx":001C
Caption = "取消(&C)"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.Label Label2
Caption = "更改密码 "
BeginProperty Font
Name = "宋体"
Size = 18
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 720
TabIndex = 10
Top = 120
Width = 2055
End
Begin VB.Label Label1
Caption = "旧 密 码:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 3
Left = 480
TabIndex = 9
Top = 990
Width = 1095
End
Begin VB.Label Label1
Caption = "重复密码:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 2
Left = 480
TabIndex = 8
Top = 1680
Width = 1215
End
Begin VB.Label Label1
Caption = "新 密 码:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 1
Left = 480
TabIndex = 7
Top = 1320
Width = 1215
End
Begin VB.Label Label1
Caption = "操 作 员:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 0
Left = 480
TabIndex = 0
Top = 630
Width = 1215
End
End
Attribute VB_Name = "frmSystemPwd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim con As New ADODB.Connection
Dim rs As New Recordset
Dim PassStr As String
Private Sub cmdCancel_Click()
Unload Me
End Sub
'密码更新
Private Sub cmdSave_Click()
Dim Password, RePassword As String
Password = Trim(txtNewPwd.Text)
RePassword = Trim(txtRepwd.Text)
If txtOldPwd.Text <> mdlCon.userPassowrd Then '检查密码是否与用户名相同
MsgBox "旧密码错误、请重新输入!", vbInformation + vbOKOnly, "密码错误"
Me.txtOldPwd.SetFocus
Me.txtOldPwd = ""
Else
PassStr = "select * from administrator where admin= '" & txtUser.Text & "'"
If mdlCon.connectTotable(con, rs, PassStr) Then
If Password <> RePassword Then
MsgBox "输入的两次新密码不同,请重新输入!", vbInformation + vbOKOnly, "输入错误"
txtNewPwd.Text = ""
txtRepwd.Text = ""
txtNewPwd.SetFocus
Else
rs!ad_pwd = txtNewPwd.Text
rs.Update
MsgBox "密码更改成功、返回主窗体!"
Unload Me
End If
End If
End If
End Sub
Private Sub Form_Activate()
txtOldPwd.SetFocus
End Sub
Private Sub Form_Load()
txtUser.Text = mdlCon.userName
End Sub
'禁止使用"% ' *"符号
Private Sub txtOldPwd_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) = "%" Or Chr(KeyAscii) = "'" Or Chr(KeyAscii) = "*" Then
KeyAscii = 0
End If
End Sub
'禁止使用"% ' *"符号
Private Sub txtNewPwd_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) = "%" Or Chr(KeyAscii) = "'" Or Chr(KeyAscii) = "*" Then
KeyAscii = 0
End If
End Sub
Private Sub txtRepwd_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) = "%" Or Chr(KeyAscii) = "'" Or Chr(KeyAscii) = "*" Then
KeyAscii = 0
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -