📄 frmuseredit.frm
字号:
VERSION 5.00
Begin VB.Form FrmUserEdit
BorderStyle = 1 'Fixed Single
Caption = "编辑用户信息"
ClientHeight = 3975
ClientLeft = 45
ClientTop = 330
ClientWidth = 4470
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3975
ScaleWidth = 4470
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Cmd_Ok
Caption = "确 定"
Height = 400
Left = 783
MouseIcon = "FrmUserEdit.frx":0000
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 4
Top = 3360
Width = 1300
End
Begin VB.CommandButton Cmd_Cancel
Cancel = -1 'True
Caption = "取 消"
Height = 400
Left = 2388
MouseIcon = "FrmUserEdit.frx":030A
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 5
Top = 3360
Width = 1300
End
Begin VB.Frame Frame1
Height = 2895
Left = 240
TabIndex = 6
Top = 240
Width = 3975
Begin VB.ComboBox ComboType
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 300
ItemData = "FrmUserEdit.frx":0614
Left = 1560
List = "FrmUserEdit.frx":0616
Style = 2 'Dropdown List
TabIndex = 3
Top = 2280
Width = 2175
End
Begin VB.TextBox txtPass2
Height = 270
IMEMode = 3 'DISABLE
Left = 1560
MaxLength = 20
PasswordChar = "*"
TabIndex = 2
Top = 1800
Width = 2175
End
Begin VB.TextBox txtPass
Height = 270
IMEMode = 3 'DISABLE
Left = 1560
MaxLength = 20
PasswordChar = "*"
TabIndex = 1
Top = 1320
Width = 2175
End
Begin VB.TextBox txtUserName
Height = 270
Left = 1560
MaxLength = 20
TabIndex = 0
Top = 840
Width = 2175
End
Begin VB.ComboBox ComboName
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 300
ItemData = "FrmUserEdit.frx":0618
Left = 1560
List = "FrmUserEdit.frx":061A
TabIndex = 7
Text = "ComboName"
Top = 300
Width = 2175
End
Begin VB.Label Label2
AutoSize = -1 'True
BackColor = &H00FFC0C0&
BackStyle = 0 'Transparent
Caption = "用户类型"
Height = 180
Left = 240
TabIndex = 12
Top = 2340
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "密码"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 180
Left = 240
TabIndex = 11
Top = 1320
Width = 360
End
Begin VB.Label Label6
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "确认密码"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 180
Left = 240
TabIndex = 10
Top = 1800
Width = 720
End
Begin VB.Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "用户名"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 180
Left = 240
TabIndex = 9
Top = 840
Width = 540
End
Begin VB.Label Label8
AutoSize = -1 'True
BackColor = &H00FFC0C0&
BackStyle = 0 'Transparent
Caption = "员工姓名"
Height = 180
Left = 240
TabIndex = 8
Top = 360
Width = 720
End
End
End
Attribute VB_Name = "FrmUserEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Modify As Boolean
Public OriUser As String
Private Sub Cmd_Cancel_Click()
Unload Me
End Sub
Private Sub Cmd_OK_Click()
If UpperEmp.Emp_Id <= 0 Then
MsgBox "请选择员工"
Exit Sub
End If
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(Trim(txtUserName)) = True Then
MsgBox "用户名已经存在,请重新输入"
txtUserName.SetFocus
txtUserName.SelStart = 0
txtUserName.SelLength = Len(txtUserName)
Exit Sub
End If
End If
.Emp_Id = UpperEmp.Emp_Id
.UserName = MakeStr(txtUserName)
.Pwd = MakeStr(txtPass)
Select Case ComboType.Text
Case "人力资源主管普通用户"
.User_type = 2
Case "系统管理员普通用户"
.User_type = 3
Case "普通用户"
.User_type = 4
End Select
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
Private Sub ComboName_GotFocus()
Dim TmpId As Integer
'将焦点设置为下一个控件,否则将反复执行此过程
txtUserName.SetFocus
'设置FrmEmpSel窗体的位置
FrmEmpSel.Left = Me.Left + ComboName.Left + 300
FrmEmpSel.Top = Me.Top + ComboName.Top + ComboName.Height + 550
FrmEmpSel.Show 1
'将选择的员工姓名显示到ComboUpper控件中
ComboName.Text = UpperEmp.Emp_Name
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -