📄 frmuseredit.frm
字号:
VERSION 5.00
Begin VB.Form FrmUserEdit
Caption = "修改密码"
ClientHeight = 2940
ClientLeft = 60
ClientTop = 390
ClientWidth = 4710
LinkTopic = "Form1"
ScaleHeight = 2940
ScaleWidth = 4710
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Cmd_Cancel
Caption = "取消"
Height = 375
Left = 2760
TabIndex = 8
Top = 2340
Width = 1095
End
Begin VB.CommandButton Cmd_Ok
Caption = "确定"
Height = 375
Left = 840
TabIndex = 7
Top = 2340
Width = 1095
End
Begin VB.Frame Frame1
Height = 1875
Left = 300
TabIndex = 0
Top = 360
Width = 4155
Begin VB.TextBox txtPass2
Height = 315
IMEMode = 3 'DISABLE
Left = 1320
PasswordChar = "*"
TabIndex = 6
Top = 1320
Width = 2355
End
Begin VB.TextBox txtPass
Height = 315
IMEMode = 3 'DISABLE
Left = 1320
PasswordChar = "*"
TabIndex = 5
Top = 780
Width = 2355
End
Begin VB.TextBox txtUserName
Height = 315
Left = 1320
TabIndex = 4
Top = 300
Width = 2355
End
Begin VB.Label Label3
Caption = "密码确认"
Height = 375
Left = 360
TabIndex = 3
Top = 1380
Width = 735
End
Begin VB.Label Label2
Caption = "密码"
Height = 315
Left = 360
TabIndex = 2
Top = 840
Width = 735
End
Begin VB.Label Label1
Caption = "用户名"
Height = 255
Left = 360
TabIndex = 1
Top = 360
Width = 675
End
End
End
Attribute VB_Name = "FrmUserEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public Modify As Boolean
Public OriUser As String
Private Sub Cmd_Cancel_Click()
Unload Me
End Sub
Private Sub Cmd_OK_Click()
'判断输入的用户名和密码是否符合标准
If Trim(txtUserName) = "" Then
MsgBox "请输入用户名"
txtUserName.SetFocus
Exit Sub
End If
If Len(txtPass) < 6 Then
MsgBox "密码长度不能小于6"
txtPass.SetFocus
txtPass.SelStart = 0
txtPass.SelLength = Len(txtPass2)
Exit Sub
End If
If txtPass <> txtPass2 Then
MsgBox "密码和确认密码不相同,请重新确认"
txtPass2.SetFocus
txtPass2.SelStart = 0
txtPass2.SelLength = Len(txtPass2)
Exit Sub
End If
'判断用户名是否已经存在
'如果是插入新的用户,则必须进行判断;如果是修改已有的用户,则当用户名被修改时进行判断
With MyUser
If Modify = False Or OriUser <> Trim(txtUserName) Then
If .In_DB(MakeStr(txtUserName)) = True Then
MsgBox "用户名已经存在,请重新输入"
txtUserName.SetFocus
txtUserName.SelStart = 0
txtUserName.SelLength = Len(txtUserName)
Exit Sub
End If
End If
.UserName = MakeStr(txtUserName)
.UserPwd = MakeStr(txtPass)
' .UserType = MakeStr(txtType)
'根据变量Modify的值决定是插入新数据,还是更新已有的数据
If Modify = False Then
.Insert
Else
.Update (OriUser)
'如果修改自身用户名,则更新CurUser对象
If OriUser = CurUser.UserName And Trim(txtUserName) <> OriUser Then
CurUser.UserName = Trim(txtUserName)
CurUser.GetInfo (CurUser.UserName)
End If
End If
End With
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -