?? frmuserman.frm
字號:
VERSION 5.00
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form FrmUserMan
BorderStyle = 1 'Fixed Single
Caption = "用戶管理"
ClientHeight = 2535
ClientLeft = 45
ClientTop = 330
ClientWidth = 6495
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2535
ScaleWidth = 6495
StartUpPosition = 2 'CenterScreen
Begin VB.Frame Frame2
Caption = "用戶信息"
Height = 1455
Left = 2760
TabIndex = 6
Top = 240
Width = 3495
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "用戶類型:"
Height = 180
Left = 240
TabIndex = 10
Top = 900
Width = 900
End
Begin VB.Label lblUserType
AutoSize = -1 'True
Caption = "lblUserType"
Height = 180
Left = 1320
TabIndex = 9
Top = 900
Width = 990
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "用戶名:"
Height = 180
Left = 240
TabIndex = 8
Top = 360
Width = 720
End
Begin VB.Label lblUserName
AutoSize = -1 'True
Caption = "lblEmpState"
Height = 180
Left = 1320
TabIndex = 7
Top = 330
Width = 990
End
End
Begin VB.CommandButton Cmd_Back
BackColor = &H80000004&
Cancel = -1 'True
Caption = "返 回"
Height = 400
Left = 4757
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 5
Top = 1920
Width = 1300
End
Begin VB.CommandButton Cmd_Del
BackColor = &H80000004&
Caption = "刪除用戶"
Height = 400
Left = 3317
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 4
Top = 1920
Width = 1300
End
Begin VB.CommandButton Cmd_Modi
BackColor = &H80000004&
Caption = "修改用戶"
Height = 400
Left = 1877
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 3
Top = 1920
Width = 1300
End
Begin VB.CommandButton Cmd_Add
BackColor = &H80000004&
Caption = "添加用戶"
Default = -1 'True
Height = 400
Left = 437
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 2
Top = 1920
Width = 1300
End
Begin VB.Frame Frame1
Caption = "用戶列表"
Height = 1455
Left = 240
TabIndex = 0
Top = 240
Width = 2295
Begin MSDataListLib.DataList DataList1
Bindings = "FrmUserMan.frx":0000
DataField = "UserName"
DataSource = "AdoUserList"
Height = 1110
Left = 120
TabIndex = 1
Top = 240
Width = 2055
_ExtentX = 3625
_ExtentY = 1826
_Version = 393216
ListField = "UserName"
End
End
Begin MSAdodcLib.Adodc AdoUserList
Height = 330
Left = 0
Top = 0
Visible = 0 'False
Width = 3135
_ExtentX = 5530
_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= 3
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "DSN=Enterprise"
OLEDBString = ""
OLEDBFile = ""
DataSourceName = "Enterprise"
OtherAttributes = ""
UserName = "sa"
Password = "sa"
RecordSource = "Select UserName From Users "
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()
With FrmUserEdit
.txtUserName = ""
.txtPass = ""
.txtPass2 = ""
.Modify = False
.Show 1
End With
AdoUserList.Refresh
DataList1_Click
End Sub
Private Sub Cmd_Back_Click()
Unload Me
End Sub
Private Sub Cmd_Del_Click()
'如果沒有選擇用戶名,則返回
If DataList1.Text = "" Then
MsgBox "請選擇要刪除的用戶"
Exit Sub
End If
'如果選擇用戶名為Admin,則提示不能刪除,返回
If Format(MyUser.UserName, "<") = "admin" Then
MsgBox "此用戶不能刪除"
Exit Sub
End If
'確認刪除
If MsgBox("是否刪除當前用戶", vbYesNo, "請確認") = vbYes Then
'刪除當前用戶
MyUser.Delete (DataList1.Text)
'刷新用戶名列表框內容
AdoUserList.Refresh
DataList1_Click
End If
End Sub
Private Sub Cmd_Modi_Click()
'如果沒有選擇用戶名,則返回
If DataList1.Text = "" Then
MsgBox "請選擇要修改的用戶"
Exit Sub
End If
'把當前用戶的數據賦值到FrmUserEdit窗體的相關位置
With FrmUserEdit
.OriUser = MyUser.UserName
.txtUserName = MyUser.UserName
.txtPass = MyUser.Pwd
.txtPass2 = MyUser.Pwd
'如果當前用戶為Admin,則不能修改用戶名
If Format(MyUser.UserName, "<") = "admin" Then
.txtUserName.Enabled = False
End If
'將變量Modify設置為True,表示當前狀態為修改已有數據
.Modify = True
'啟動窗體FrmUserEdit
.Show 1
End With
'刷新用戶名列表框
AdoUserList.Refresh
DataList1_Click
End Sub
Private Sub DataList1_Click()
'如果沒有選擇用戶名,則返回
If DataList1.Text = "" Then
Exit Sub
End If
'讀取當前用戶數據
MyUser.GetInfo (DataList1.Text)
'設置用戶名
lblUserName = MyUser.UserName
'設置用戶類型
If MyUser.UserName = "admin" Then
lblUserType = "系統管理員"
Else
lblUserType = "普通用戶"
End If
End Sub
Private Sub Form_Load()
lblUserType = ""
lblUserName = ""
'AdoUserList.RecordSource = "SELECT UserName From Users"
AdoUserList.Refresh
DataList1.Refresh
DataList1_Click
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -