?? frmuserman.frm
字號(hào):
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Begin VB.Form FrmUserMan
Caption = "用戶管理"
ClientHeight = 3240
ClientLeft = 60
ClientTop = 450
ClientWidth = 4140
LinkTopic = "Form1"
ScaleHeight = 3240
ScaleWidth = 4140
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame1
Caption = "用戶列表"
Height = 2895
Left = 0
TabIndex = 5
Top = 120
Width = 2295
Begin MSDataListLib.DataList DataList1
Height = 2595
Left = 120
TabIndex = 6
Top = 240
Width = 2055
_ExtentX = 3625
_ExtentY = 4551
_Version = 393216
ListField = ""
BoundColumn = ""
End
End
Begin VB.CommandButton Cmd_Add
BackColor = &H80000004&
Caption = "添加用戶"
Default = -1 'True
Height = 400
Left = 2520
MouseIcon = "FrmUserMan.frx":0000
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 4
Top = 240
Width = 1300
End
Begin VB.CommandButton Cmd_Modi
BackColor = &H80000004&
Caption = "修改用戶"
Height = 400
Left = 2520
MouseIcon = "FrmUserMan.frx":030A
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 3
Top = 840
Width = 1300
End
Begin VB.CommandButton Cmd_Del
BackColor = &H80000004&
Caption = "刪除用戶"
Height = 400
Left = 2520
MouseIcon = "FrmUserMan.frx":0614
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 2
Top = 1440
Width = 1300
End
Begin VB.CommandButton Cmd_Back
BackColor = &H80000004&
Cancel = -1 'True
Caption = "返 回"
Height = 400
Left = 2520
MouseIcon = "FrmUserMan.frx":091E
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 1
Top = 2640
Width = 1300
End
Begin VB.CommandButton cmd_Rest
BackColor = &H80000004&
Caption = "密碼重置"
Height = 400
Left = 2520
MouseIcon = "FrmUserMan.frx":0C28
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 0
Top = 2040
Width = 1300
End
Begin MSAdodcLib.Adodc AdoUserList
Height = 330
Left = 1920
Top = 0
Visible = 0 'False
Width = 1335
_ExtentX = 2355
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 1
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "AdoUserList"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
End
Attribute VB_Name = "FrmUserMan"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Cmd_Add_Click()
'設(shè)置為添加記錄狀態(tài)
FrmUserEdit.Modify = False
FrmUserEdit.Show 1
Refresh_Users
End Sub
Private Sub Refresh_Users()
'刷新顯示
AdoUserList.ConnectionString = Conn
AdoUserList.RecordSource = "Select * From Users Order By UserName"
AdoUserList.Refresh
Set DataList1.RowSource = AdoUserList
DataList1.ListField = "EmpName"
DataList1.BoundColumn = "UserName"
DataList1_Click
End Sub
Private Sub Cmd_Back_Click()
Unload Me
End Sub
Private Sub Cmd_Del_Click()
'判斷是否選擇了要?jiǎng)h除的用戶
If DataList1.Text = "" Then
MsgBox "請(qǐng)選擇要?jiǎng)h除的用戶"
Exit Sub
End If
'不能刪除Admin用戶
If MyUser.UserType = 0 Then
MsgBox "此用戶不能刪除"
Exit Sub
End If
'確認(rèn)刪除
If MsgBox("是否刪除當(dāng)前用戶", vbYesNo, "請(qǐng)確認(rèn)") = vbYes Then
MyUser.Delete (MyUser.UserName)
Refresh_Users
DataList1_Click
End If
End Sub
Private Sub Cmd_Modi_Click()
'判斷是否選擇了要修改的用戶
If DataList1.Text = "" Then
MsgBox "請(qǐng)選擇要修改的用戶"
Exit Sub
End If
With FrmUserEdit
'用戶名
.OriUser = Trim(DataList1.BoundText())
.txtUserName = Trim(DataList1.BoundText())
MyUser.GetInfo (Trim(DataList1.BoundText()))
'密碼
.txtPass = "111111"
.txtPass2 = "111111"
.txtPass.Enabled = False
.txtPass2.Enabled = False
'添加用戶類型
.ComboType.ListIndex = MyUser.UserType
'不能修改用戶名
.txtUserName.Enabled = False
'人員姓名
.txtEmpName = Trim(DataList1.Text)
'設(shè)置當(dāng)前狀態(tài)為修改
.Modify = True
.Show 1
End With
'刷新用戶顯示
Refresh_Users
DataList1_Click
End Sub
Private Sub cmd_Rest_Click()
If DataList1.Text = "" Then
MsgBox "請(qǐng)選擇要修改的用戶"
Exit Sub
End If
If MsgBox("是否重置當(dāng)前用戶的密碼", vbYesNo, "請(qǐng)確認(rèn)") = vbYes Then
MyUser.UpdatePwdPwd (Trim(DataList1.BoundText()))
DataList1_Click
End If
End Sub
Private Sub DataList1_Click()
If DataList1.Text = "" Then
Exit Sub
End If
'讀取用戶數(shù)據(jù)
MyUser.GetInfo (DataList1.BoundText())
End Sub
Private Sub Form_Load()
Refresh_Users
End Sub
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -