?? frmuseredit.frm
字號:
VERSION 5.00
Begin VB.Form FrmUserEdit
BorderStyle = 1 'Fixed Single
Caption = "編輯用戶信息"
ClientHeight = 3555
ClientLeft = 45
ClientTop = 330
ClientWidth = 4455
Icon = "FrmUserEdit.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3555
ScaleWidth = 4455
StartUpPosition = 2 'CenterScreen
Begin VB.Frame Frame1
Height = 2655
Left = 240
TabIndex = 5
Top = 120
Width = 3975
Begin VB.ComboBox ComboType
Height = 300
ItemData = "FrmUserEdit.frx":0CCA
Left = 1560
List = "FrmUserEdit.frx":0CCC
Style = 2 'Dropdown List
TabIndex = 11
Top = 1650
Width = 2175
End
Begin VB.TextBox txtEmpName
Height = 270
IMEMode = 3 'DISABLE
Left = 1560
MaxLength = 20
TabIndex = 9
Top = 2115
Width = 2175
End
Begin VB.TextBox txtUserName
Height = 270
Left = 1560
MaxLength = 20
TabIndex = 0
Top = 315
Width = 2175
End
Begin VB.TextBox txtPass
Height = 270
IMEMode = 3 'DISABLE
Left = 1560
MaxLength = 20
PasswordChar = "*"
TabIndex = 1
Top = 765
Width = 2175
End
Begin VB.TextBox txtPass2
Height = 270
IMEMode = 3 'DISABLE
Left = 1560
MaxLength = 20
PasswordChar = "*"
TabIndex = 2
Top = 1215
Width = 2175
End
Begin VB.Label Label3
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 = 12
Top = 2160
Width = 720
End
Begin VB.Label Label2
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 = 1710
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 = 8
Top = 360
Width = 540
End
Begin VB.Label Label6
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "確認(rèn)密碼"
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 = 7
Top = 1260
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 = 6
Top = 810
Width = 360
End
End
Begin VB.CommandButton Cmd_Cancel
Cancel = -1 'True
Caption = "取 消"
Height = 400
Left = 2380
MouseIcon = "FrmUserEdit.frx":0CCE
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 4
Top = 3000
Width = 1300
End
Begin VB.CommandButton Cmd_Ok
Caption = "確 定"
Height = 400
Left = 775
MouseIcon = "FrmUserEdit.frx":0FD8
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 3
Top = 3000
Width = 1300
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()
'判斷用戶錄入數(shù)據(jù)的有效性
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 "密碼和確認(rèn)密碼不相同,請重新確認(rèn)"
txtPass2.SetFocus
txtPass2.SelStart = 0
txtPass2.SelLength = Len(txtPass2)
Exit Sub
End If
If Trim(txtEmpName) = "" Then
MsgBox "請輸入人員姓名"
txtEmpName.SetFocus
Exit Sub
End If
With MyUser
'在添加新用戶以及當(dāng)前用戶名與原用戶名不同時(shí),需要判斷新用戶名是否存在
If Modify = False Or OriUser <> Trim(txtUserName) Then
'如果用戶名存在,則提示要重新錄入
If .In_DB(Trim(txtUserName)) = True Then
MsgBox "用戶名已經(jīng)存在,請重新輸入"
txtUserName.SetFocus
txtUserName.SelStart = 0
txtUserName.SelLength = Len(txtUserName)
Exit Sub
End If
End If
'將用戶錄入的數(shù)據(jù)賦值到MyUser對象中
.UserName = MakeStr(txtUserName)
.EmpName = MakeStr(txtEmpName)
.UserPwd = MakeStr(txtPass)
.UserType = ComboType.ListIndex
'根據(jù)變量Modify的值,決定是插入新數(shù)據(jù),還是修改當(dāng)前數(shù)據(jù)
If Modify = False Then
.Insert
Else
.Update (OriUser)
End If
'如果是修改自身的用戶信息,則將修改后的信息讀取到CurUser對象中
If CurUser.UserName = OriUser Then
CurUser.GetInfo (MakeStr(txtUserName))
End If
End With
'關(guān)閉窗體
Unload Me
End Sub
Private Sub Form_Load()
ComboType.AddItem "管理員用戶", 0
ComboType.AddItem "領(lǐng)班用戶", 1
ComboType.AddItem "普通用戶", 2
ComboType.ListIndex = 0
End Sub
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -