【VB开源代码栏目提醒】:网学会员鉴于大家对VB开源代码十分关注,论文会员在此为大家搜集整理了“FMPwd.frm”一文,供大家参考学习
VERSION 5.00
Begin VB.Form FMPwd
Caption = "密码设置"
ClientHeight = 3375
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3375
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "主界面"
Height = 495
Left = 3360
TabIndex = 8
Top = 2760
Width = 975
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 495
Left = 1800
TabIndex = 7
Top = 2760
Width = 1095
End
Begin VB.Frame Frame1
Caption = "修改密码"
Height = 2415
Left = 0
TabIndex = 0
Top = 120
Width = 4695
Begin VB.TextBox TextCodeN
Height = 375
IMEMode = 3 'DISABLE
Left = 1920
PasswordChar = "*"
TabIndex = 6
Top = 1680
Width = 1695
End
Begin VB.TextBox TextCode
Height = 375
IMEMode = 3 'DISABLE
Left = 1920
Pass
wordChar = "*"
TabIndex = 5
Top = 1020
Width = 1695
End
Begin
VB.TextBox TextUserID
Height = 375
Left = 1920
TabIndex = 4
Top = 360
Width = 1695
End
Begin VB.Label Label3
Caption = "新密码:"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 720
TabIndex = 3
Top = 1800
Width = 1095
End
Begin VB.Label Label2
Caption = "原密码:"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 720
TabIndex = 2
Top = 1140
Width = 1095
End
Begin VB.Label Label1
Caption = "用户名:"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 720
TabIndex = 1
Top = 480
Width = 1095
End
End
End
Attribute VB_Name = "FMPwd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
Dim ModCode As New ADODB.Recordset
Dim Str As String
Dim sUserID As String
Dim sCode As String
Dim sCodeN As String
If Trim(Me.TextUserID.Text) = "" Then
MsgBox "请输入用户ID!"
Exit Sub
End If
sUserID = Trim(Me.TextUserID.Text)
If Trim(Me.TextCode.Text) = "" Then
MsgBox "请输入原密码!"
Exit Sub
End If
sCode = Trim(Me.TextCode.Text)
If Trim(Me.TextCodeN.Text) = "" Then
MsgBox "请输入新密码!"
Exit Sub
End If
If Trim(Me.TextCodeN.Text) = Trim(Me.TextCode.Text) Then
MsgBox "输入的原密码和新密码一致!"
Exit Sub
End If
sCodeN = Trim(Me.TextCodeN.Text)
Str = "select * from UserInfo where UserID='" & sUserID & "'"
ModCode.Open Str, g_DBConn, adOpenStatic, adLockOpti
mistic
ModCode.MoveFirst
If Trim(Me.TextCode.Text) = ModCode.Fields("UserPwd").Value Then
ModCode.Fields("UserPwd").Value = Trim(Me.TextCodeN.Text)
Else
MsgBox "原密码错误,修改失败!"
Exit Sub
End If
ModCode.Update
ModCode.Close
MsgBox "修改成功!"
Me.TextUserID.Text = ""
Me.TextCode.Text = ""
Me.TextCodeN.Text = ""
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Me.Top = (Screen.Height - Me.Height) / 2 '垂直方向居中
Me.Left = (Screen.Width - Me.Height) / 2 '水平方向居中
End Sub