📄 frmpassword.frm
字号:
VERSION 5.00
Begin VB.Form frmPassWord
Caption = "PassWord"
ClientHeight = 4080
ClientLeft = 60
ClientTop = 345
ClientWidth = 4380
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4080
ScaleWidth = 4380
StartUpPosition = 1 'CenterOwner
Begin VB.CommandButton cmdCancel
Caption = "Cancel"
Height = 495
Left = 2400
TabIndex = 6
Top = 3360
Width = 1215
End
Begin VB.CommandButton cmdok
Caption = "OK"
Height = 495
Left = 720
TabIndex = 5
Top = 3360
Width = 1215
End
Begin VB.PictureBox Picture2
Height = 1095
Left = 240
ScaleHeight = 1035
ScaleWidth = 3675
TabIndex = 11
Top = 1980
Width = 3735
Begin VB.TextBox txtConfirm
Height = 270
IMEMode = 3 'DISABLE
Left = 1800
PasswordChar = "*"
TabIndex = 4
Top = 600
Width = 1740
End
Begin VB.TextBox txtNew
Height = 270
IMEMode = 3 'DISABLE
Left = 1800
PasswordChar = "*"
TabIndex = 3
Top = 120
Width = 1740
End
Begin VB.Label Label5
Caption = "Confirm PassWord"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 0
TabIndex = 13
Top = 600
Width = 1695
End
Begin VB.Label Label4
Caption = "New PassWord"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 360
TabIndex = 12
Top = 120
Width = 1335
End
End
Begin VB.PictureBox Picture1
Height = 1695
Left = 240
ScaleHeight = 1635
ScaleWidth = 3675
TabIndex = 7
Top = 240
Width = 3735
Begin VB.TextBox txtCode
Height = 270
Left = 1800
MaxLength = 6
TabIndex = 1
Top = 120
Width = 1740
End
Begin VB.TextBox txtName
Height = 270
Left = 1800
Locked = -1 'True
TabIndex = 0
TabStop = 0 'False
Top = 600
Width = 1740
End
Begin VB.TextBox txtPass
Height = 270
IMEMode = 3 'DISABLE
Left = 1800
PasswordChar = "*"
TabIndex = 2
Top = 1095
Width = 1740
End
Begin VB.Label Label1
Caption = "User Code"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 480
TabIndex = 10
Top = 135
Width = 1095
End
Begin VB.Label Label2
Caption = "User Name"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 480
TabIndex = 9
Top = 615
Width = 1095
End
Begin VB.Label Label3
Caption = "Old PassWord"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 360
TabIndex = 8
Top = 1095
Width = 1335
End
End
End
Attribute VB_Name = "frmPassWord"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim OldPassWord As String
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Dim sCode As String
Dim sOldPass As String
Dim sNewPass As String
Dim sConfirm As String
sCode = Trim(txtCode.Text)
If sCode = "" Then
Exit Sub
End If
sOldPass = Trim(txtPass.Text)
sNewPass = Trim(txtNew.Text)
sConfirm = Trim(txtConfirm.Text)
If LCase(gsUserCode) <> "admin" Then
If LCase(OldPassWord) <> LCase(sOldPass) Then
MsgBox "Old PassWord is Worng,Please Input again!", vbOKOnly, "Error"
Exit Sub
Else
If LCase(sNewPass) <> LCase(sConfirm) Then
MsgBox "New PassWord is Worng,Please Input again!", vbOKOnly, "Error"
Exit Sub
End If
Call UpdatePassWord(sCode, sNewPass)
MsgBox "Change PassWord Successed", vbOKOnly, "Sucessed"
Unload Me
End If
Else
If LCase(sNewPass) <> LCase(sConfirm) Then
MsgBox "New PassWord is Worng,Please Input again!", vbOKOnly, "Error"
Exit Sub
End If
Call UpdatePassWord(sCode, sNewPass)
MsgBox "Change PassWord Successed", vbOKOnly, "Sucessed"
Unload Me
End If
End Sub
Private Sub UpdatePassWord(ByVal sCode As String, ByVal sNewPass As String)
Dim sSQL As String
sSQL = "update sysusr set passwrd='" & sNewPass & "' where usrcode='" & sCode & "'"
Acs_cnt.BeginTrans
Acs_cnt.Execute (sSQL)
Acs_cnt.CommitTrans
End Sub
Private Sub txtCode_KeyDown(KeyCode As Integer, Shift As Integer)
Dim sCode As String, sname As String
Dim rstClerk As Recordset
Dim sSQL As String
sname = ""
If KeyCode = vbKeyReturn Then
sCode = Trim(txtCode.Text)
If txtCode = "" Then
MsgBox "Please input UserCode.", vbOKOnly, "Message"
Exit Sub
End If
sSQL = "select * from sysusr where usrcode='" & sCode & "' "
Set rstClerk = Acs_cnt.Execute(sSQL)
With rstClerk
Do While Not .EOF
sCode = rstClerk!UsrCode
sname = rstClerk!UrsName
OldPassWord = rstClerk!passwrd
.MoveNext
Loop
End With
txtName.Text = sname
If txtName.Text = "" Then
MsgBox "Your code is wrong!", vbOKOnly, "Message"
End If
rstClerk.Close
If rstClerk Is Nothing Then Set rstClerk = Nothing
End If
End Sub
Private Sub txtcode_KeyUp(KeyCode As Integer, Shift As Integer)
If txtName.Text <> "" Then
If KeyCode = vbKeyReturn Then
SendKeys "{tab}"
End If
End If
End Sub
Private Sub txtConfirm_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
SendKeys "{tab}"
End If
End Sub
Private Sub txtNew_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
SendKeys "{tab}"
End If
End Sub
Private Sub txtPass_KeyUp(KeyCode As Integer, Shift As Integer)
If LCase(gsUserCode) <> "admin" Then
If KeyCode = vbKeyReturn And txtPass.Text = OldPassWord Then
' If txtPass.Text <> OldPassWord Then
' MsgBox "PassWord is Wrong,Please Input again!", vbOKOnly, "Wrong"
' Exit Sub
' ElseIf txtPass.Text = OldPassWord Then
SendKeys "{tab}"
' End If
End If
Else
If KeyCode = vbKeyReturn Then
SendKeys "{tab}"
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -