?? frmchpwd.frm
字號:
VERSION 5.00
Begin VB.Form frmChPwd
BackColor = &H00C0FFC0&
BorderStyle = 1 'Fixed Single
Caption = "密碼修改"
ClientHeight = 3915
ClientLeft = 45
ClientTop = 330
ClientWidth = 5565
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3915
ScaleWidth = 5565
Begin VB.CommandButton cmdChPwdCancel
Caption = "取 消"
Height = 495
Left = 3240
TabIndex = 10
Top = 3240
Width = 1455
End
Begin VB.CommandButton cmdChPwdOk
Caption = "確 定"
Height = 495
Left = 1080
TabIndex = 9
Top = 3240
Width = 1455
End
Begin VB.Frame fraChPwd
BackColor = &H00C0FFC0&
Height = 2775
Left = 600
TabIndex = 0
Top = 240
Width = 4455
Begin VB.ComboBox Combofind
Height = 300
Left = 1560
TabIndex = 1
Text = "請選擇用戶"
Top = 360
Width = 2055
End
Begin VB.TextBox txtNewPwdagain
Height = 405
IMEMode = 3 'DISABLE
Left = 1560
PasswordChar = "*"
TabIndex = 4
Top = 2160
Width = 2055
End
Begin VB.TextBox txtNewPwd
Height = 375
IMEMode = 3 'DISABLE
Left = 1560
PasswordChar = "*"
TabIndex = 3
Top = 1560
Width = 2055
End
Begin VB.TextBox txtOldPwd
Height = 375
IMEMode = 3 'DISABLE
Left = 1560
PasswordChar = "*"
TabIndex = 2
Top = 960
Width = 2055
End
Begin VB.Label lblPwdagain
AutoSize = -1 'True
BackColor = &H00C0FFC0&
Caption = "新密碼:"
Height = 180
Left = 480
TabIndex = 8
Top = 2280
Width = 720
End
Begin VB.Label lblNewPwd
AutoSize = -1 'True
BackColor = &H00C0FFC0&
Caption = "新密碼:"
Height = 180
Left = 480
TabIndex = 7
Top = 1680
Width = 720
End
Begin VB.Label lblOldPwd
AutoSize = -1 'True
BackColor = &H00C0FFC0&
Caption = "原密碼:"
Height = 180
Left = 480
TabIndex = 6
Top = 1080
Width = 720
End
Begin VB.Label lblChUser
AutoSize = -1 'True
BackColor = &H00C0FFC0&
Caption = "用戶名:"
Height = 180
Left = 480
TabIndex = 5
Top = 480
Width = 720
End
End
End
Attribute VB_Name = "frmChPwd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdChPwdCancel_Click()
Unload Me
End Sub
Private Sub cmdChPwdOk_Click()
Dim rs_chpwd As New ADODB.Recordset
Dim sql As String
'先檢測兩次輸入的新密碼時候一樣
If txtNewPwd.Text <> txtNewPwdagain.Text Then
MsgBox "兩次輸入的密碼不同!請重新輸入", vbOKOnly + vbInformation, "密碼修改"
'光標定位于新密碼textbox中
txtNewPwd.SetFocus
txtNewPwd.Text = ""
txtNewPwdagain.Text = ""
Exit Sub
End If
'先檢查此用戶名及密碼是否正確
sql = "select * from 系統管理 where czyh = '" & Combofind.Text & "' and " _
& " mm= '" & txtOldPwd.Text & "'"
rs_chpwd.Open sql, conn, adOpenKeyset, adLockPessimistic
If rs_chpwd.EOF = True Then
MsgBox "老用戶名或密碼錯誤!", vbOKOnly + vbExclamation, "密碼修改"
Combofind.Text = ""
Combofind.SetFocus
txtOldPwd.Text = ""
rs_chpwd.Close
Exit Sub
Else
'修改密碼
rs_chpwd.Fields(1) = txtNewPwd.Text
rs_chpwd.Update
MsgBox "修改密碼成功!", vbOKOnly + vbInformation, "密碼修改"
rs_chpwd.Close
Unload Me
End If
End Sub
Private Sub Combofind_Click()
If Combofind.Text <> "請選擇用戶" Then
txtOldPwd.SetFocus
End If
End Sub
Private Sub Form_Load()
Dim rs_mm As New ADODB.Recordset
Dim sql As String
sql = "select 系統管理.czyh from 系統管理"
rs_mm.CursorLocation = adUseClient
rs_mm.Open sql, conn, adOpenKeyset, adLockPessimistic
rs_mm.MoveFirst
For i = 0 To rs_mm.RecordCount - 1
Combofind.AddItem rs_mm.Fields(0)
rs_mm.MoveNext
Next i
rs_mm.Close
Dim X0 As Long
Dim Y0 As Long
'讓窗體居中
X0 = Screen.Width
Y0 = Screen.Height
X0 = (X0 - Me.Width) / 2
Y0 = (Y0 - Me.Height) / 2
Me.Move X0, Y0
End Sub
Private Sub txtNewPwd_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtNewPwdagain.SetFocus
cmdChPwdOk.Default = True
End If
End Sub
Private Sub txtOldPwd_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtNewPwd.SetFocus
End If
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -