?? changepwdfrm.frm
字號:
VERSION 5.00
Begin VB.Form Changepwdfrm
Caption = "修改密碼"
ClientHeight = 4890
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 4890
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox renewpwdtxt
Height = 495
Left = 2160
TabIndex = 7
Top = 2160
Width = 2295
End
Begin VB.TextBox newpwdtxt
Height = 495
Left = 2160
TabIndex = 6
Top = 1080
Width = 2295
End
Begin VB.TextBox oldpwdtxt
Height = 495
Left = 2160
TabIndex = 5
Top = 240
Width = 2295
End
Begin VB.CommandButton Command2
Caption = "放棄"
Height = 615
Left = 2280
TabIndex = 4
Top = 3840
Width = 1695
End
Begin VB.CommandButton Command1
Caption = "修改"
Height = 615
Left = 240
TabIndex = 3
Top = 3840
Width = 1455
End
Begin VB.Label Label3
Caption = "重新輸入"
Height = 735
Left = 120
TabIndex = 2
Top = 2040
Width = 1695
End
Begin VB.Label Label2
Caption = "新密碼"
Height = 615
Left = 120
TabIndex = 1
Top = 1080
Width = 1575
End
Begin VB.Label Label1
Caption = "原來密碼"
Height = 495
Left = 240
TabIndex = 0
Top = 240
Width = 1455
End
End
Attribute VB_Name = "Changepwdfrm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim idinfo As Recordset '記錄集
Dim sqlstr As String '存儲sql命令字符串
Dim changeable As Boolean '標記是否密碼可以修改
If (oldpwdtxt.Text <> "" And newpwdtxt.Text <> "" And (newpwdtxt.Text = renewpwdtxt.Text)) Then
'如果密碼非空,且新密碼的兩次鍵入相一致,則標記changeable為真
changeable = True
Else
MsgBox "請重新輸入新密碼,并確保新密碼的兩次輸入一致", vbOKOnly, "修改密碼出錯"
'清空各文本框,以便重新輸入
oldpwdtxt.Text = ""
newpwdtxt.Text = ""
renewpwdtxt.SetFocus
End If
If changeable Then
sqlstr = "select 密碼 where 學號='" & ID & "'"
Set idinfo = courseDB.OpenRecordset(sqlstr, dbOpenDynaset) '打開記錄集,以備修改
If (idinfo.Fields("密碼").Value = oldwdtxt.Text) Then '如果舊密碼正確,則修改密碼'更新密碼
With idinfo
.Edit
!密碼 = newpwdtxt.Text
.Update
.Bookmark = .LastModified
End With
MsgBox "密碼修改成功", vbOKOnly, "成功"
Unload Changepwdfrm '退出窗體
Else '就密碼錯誤,提示重新輸入
MsgBox "密碼錯誤,請重試!", vbOKOnly, "修改密碼出錯"
'清空各文本框,以便重新輸入
oldpwdtxt.Text = ""
newpwdtxt.Text = ""
renewpwdtxt.Text = ""
oldpwdtxt.SetFocus
End If
idinfo.Close '關閉記錄集
End Sub
'放棄修改
End Sub
Private Sub Command2_Click()
Unload Changepwdfrm
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -