📄 frmpwupdate.frm
字号:
VERSION 5.00
Begin VB.Form frmPWupdate
BorderStyle = 1 'Fixed Single
Caption = "用户密码修改"
ClientHeight = 3270
ClientLeft = 4725
ClientTop = 4740
ClientWidth = 5385
Icon = "frmPWupdate.frx":0000
LinkTopic = "Form3"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3270
ScaleWidth = 5385
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = ""
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 285
Left = 4080
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "密码表"
Top = 240
Visible = 0 'False
Width = 1140
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 495
Left = 3240
TabIndex = 7
Top = 2640
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 495
Left = 840
TabIndex = 6
Top = 2640
Width = 1215
End
Begin VB.TextBox Text3
Height = 270
Left = 1920
TabIndex = 5
Top = 2040
Width = 1815
End
Begin VB.TextBox Text2
Height = 270
Left = 1920
TabIndex = 4
Top = 1440
Width = 1815
End
Begin VB.TextBox Text1
Height = 270
Left = 1920
TabIndex = 3
Top = 840
Width = 1815
End
Begin VB.Label Label5
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1920
TabIndex = 9
Top = 240
Width = 1215
End
Begin VB.Label Label4
Caption = "确认新密码"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 600
TabIndex = 8
Top = 2040
Width = 1215
End
Begin VB.Label Label3
Caption = "新密码"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 600
TabIndex = 2
Top = 1440
Width = 1215
End
Begin VB.Label Label2
Caption = "原密码"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 600
TabIndex = 1
Top = 840
Width = 1215
End
Begin VB.Label Label1
Caption = "当前用户"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 600
TabIndex = 0
Top = 240
Width = 1215
End
End
Attribute VB_Name = "frmPWupdate"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim myheight, mywidth As Integer '保持窗体大小的相关声明
Private Sub Command1_Click()
If Text1.Text = "" And Text2.Text = "" And Text3.Text = "" Then '密码更新检测
MsgBox "你没有输入更新信息!", , "提示"
Else
If Text1.Text = "" Then
MsgBox "请输入原密码!", , "提示"
Else
If Text2.Text = "" Then
MsgBox "请输入新密码!", , "提示"
Else
If Text3.Text = "" Then
MsgBox "请确认你的新密码!", , "提示"
Else
If Text2.Text <> Text3.Text Then
MsgBox "你两次输入的密码不同,请重新输入!", , "提示"
Text2.Text = ""
Text3.Text = ""
Text2.SetFocus
Else
Dim password As String
password = "password=" & "'" & Trim(Text1.Text) & "'"
Data1.Recordset.FindFirst password
If Data1.Recordset.NoMatch Then
MsgBox "你输入的原密码有误!", , "提示"
Else
Data1.Recordset.AddNew
Data1.Recordset.Fields("useid") = Label5.Caption
Data1.Recordset.Fields("password") = Text2.Text
Data1.Recordset.Update
Data1.Recordset.Delete
MsgBox "你已经成功的更换了新密码,请使用新密码!", , "提示"
End If
End If
End If
End If
End If
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
mywidth = Me.Width '保持窗体大小
myheight = Me.Height
Data1.DatabaseName = App.Path + "\水电费管理系统数据库.mdb"
Data1.RecordSource = "密码表"
End Sub
Private Sub Form_Resize()
Me.Height = myheight '保持窗体大小
Me.Width = mywidth
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then SendKeys "{tab}" '原密码框中按回车,焦点下移
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then SendKeys "{tab}" '新密码框中按回车,焦点下移
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Command1_Click '此框中按回车,等同于按"确定"按钮
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -