📄 frmmanagr.frm
字号:
VERSION 5.00
Begin VB.Form FrmManage
Caption = "系统管理"
ClientHeight = 4065
ClientLeft = 60
ClientTop = 345
ClientWidth = 9120
Icon = "FrmManagr.frx":0000
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 4615.47
ScaleMode = 0 'User
ScaleWidth = 9295.104
Begin VB.Frame Frame2
Height = 3975
Left = 120
TabIndex = 11
Top = 0
Width = 8895
Begin VB.Frame Frame4
Caption = "用户列表"
Height = 1095
Left = 720
TabIndex = 27
Top = 2760
Width = 2415
Begin VB.ListBox List1
Height = 780
Left = 120
TabIndex = 28
Top = 240
Width = 2175
End
End
Begin VB.CommandButton Command2
Caption = "删除"
Enabled = 0 'False
Height = 375
Left = 3360
TabIndex = 26
Top = 3240
Width = 735
End
Begin VB.Frame Frame1
Caption = "登录者属性:"
BeginProperty Font
Name = "黑体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 2295
Left = 240
TabIndex = 18
Top = 120
Width = 3975
Begin VB.TextBox Text2
Alignment = 2 'Center
Enabled = 0 'False
Height = 270
IMEMode = 3 'DISABLE
Left = 1320
MaxLength = 12
TabIndex = 1
Text = "系统自动检查"
Top = 840
Width = 1335
End
Begin VB.TextBox Text3
Height = 270
IMEMode = 3 'DISABLE
Left = 1320
MaxLength = 12
PasswordChar = "*"
TabIndex = 2
Top = 1320
Width = 1335
End
Begin VB.TextBox Text4
Height = 270
IMEMode = 3 'DISABLE
Left = 1320
MaxLength = 12
PasswordChar = "*"
TabIndex = 3
Top = 1800
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "更改"
Height = 375
Left = 2880
TabIndex = 4
Top = 960
Width = 855
End
Begin VB.ComboBox Combo1
Height = 300
Left = 1320
TabIndex = 0
Top = 360
Width = 1335
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "登录姓名:"
Height = 180
Left = 360
TabIndex = 22
Top = 360
Width = 900
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "原始密码:"
Height = 180
Left = 360
TabIndex = 21
Top = 840
Width = 900
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "更新密码:"
Height = 180
Left = 360
TabIndex = 20
Top = 1320
Width = 900
End
Begin VB.Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "确认密码:"
Height = 180
Left = 360
TabIndex = 19
Top = 1800
Width = 900
End
End
Begin VB.Frame Frame3
Caption = "增改用户:"
BeginProperty Font
Name = "黑体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 2655
Left = 4440
TabIndex = 12
Top = 120
Width = 4215
Begin VB.TextBox Text7
Height = 270
Left = 1440
MaxLength = 50
TabIndex = 23
Top = 2280
Width = 2535
End
Begin VB.CommandButton Command3
Caption = "添加"
Height = 375
Left = 3000
TabIndex = 10
Top = 960
Width = 855
End
Begin VB.ComboBox Combo2
Height = 300
Left = 1440
TabIndex = 8
Top = 1440
Width = 1335
End
Begin VB.TextBox Text1
Height = 270
IMEMode = 3 'DISABLE
Left = 1440
MaxLength = 8
TabIndex = 5
Top = 360
Width = 1335
End
Begin VB.TextBox Text5
Height = 270
IMEMode = 3 'DISABLE
Left = 1440
MaxLength = 12
PasswordChar = "*"
TabIndex = 6
Top = 720
Width = 1335
End
Begin VB.TextBox Text6
Height = 270
IMEMode = 3 'DISABLE
Left = 1440
MaxLength = 12
PasswordChar = "*"
TabIndex = 7
Top = 1080
Width = 1335
End
Begin VB.ComboBox Combo3
Height = 300
ItemData = "FrmManagr.frx":030A
Left = 1440
List = "FrmManagr.frx":030C
TabIndex = 9
Top = 1850
Width = 1335
End
Begin VB.Label Label5
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "备注:"
Height = 180
Left = 720
TabIndex = 24
Top = 2160
Width = 540
End
Begin VB.Label Label7
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "新用户名:"
Height = 180
Left = 360
TabIndex = 17
Top = 360
Width = 900
End
Begin VB.Label Label8
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "设立密码:"
Height = 180
Left = 360
TabIndex = 16
Top = 720
Width = 900
End
Begin VB.Label Label9
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "确认密码:"
Height = 180
Left = 360
TabIndex = 15
Top = 1080
Width = 900
End
Begin VB.Label Label10
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "添加者:"
Height = 180
Left = 480
TabIndex = 14
Top = 1440
Width = 720
End
Begin VB.Label Label11
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "权限:"
Height = 180
Left = 720
TabIndex = 13
Top = 1800
Width = 540
End
End
Begin VB.Label Label6
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "管理员可更改所有用户密码等相关信息!"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000C0&
Height = 210
Left = 240
TabIndex = 25
Top = 2520
Width = 4050
End
End
End
Attribute VB_Name = "FrmManage"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim CmdExe As ADODB.Command
Dim Rsb As ADODB.Recordset
Private Sub Command1_Click()
If Combo1.ListIndex = -1 Then
MsgBox "没有此登录者,请确认选择!"
Exit Sub
End If
If Text3.Text = Text4.Text And Text3.Text <> "" Then
CmdExe.CommandText = "UPDATE Login SET 密码 = '" & Text3.Text & "' WHERE 登录姓名='" & Combo1.Text & "'"
CmdExe.Execute
MsgBox Combo1.Text & ",您的密码已被成功更改!", , "密码更改:"
Else
MsgBox "更改密码与确认密码不相符或空!"
End If
Text3.Text = ""
Text4.Text = ""
End Sub
Private Sub Command2_Click()
On Error GoTo err
If List1.ListIndex > 0 Then
Rsb.Delete
End If
List1.Clear
Combo2.Clear
Rsb.Close
Rsb.Open "Login", Con, adOpenStatic, adLockPessimistic, adCmdTable
Do While Not Rsb.EOF
Combo2.AddItem Rsb!登录姓名
List1.AddItem Rsb!登录姓名
Rsb.MoveNext
Loop
Exit Sub
err:
Call ExecErr(Date, Me.Caption, err.Number, err.Source, err.Description)
End Sub
Private Sub Command3_Click()
If Combo2.ListIndex = -1 Or Combo3.ListIndex = -1 Then
MsgBox "请确认选择添加者及权限!"
Exit Sub
End If
If Trim(Text7.Text) = "" Then
MsgBox "备注一栏也不能为空!"
Exit Sub
End If
If Text5.Text = Text6.Text And Text5.Text <> "" Then
CmdExe.CommandText = "insert into Login(登录姓名,密码,权限,添加者,备注) values " & "('" & Text1.Text & "','" & Text5.Text & "','" & Combo3.ListIndex & "','" & Combo2.Text & "','" & Text7.Text & "')"
CmdExe.Execute
MsgBox Text1.Text & ",欢迎您加入!", , "成功添加:"
Text5.Text = ""
Text6.Text = ""
If Permission = 1 Then
Exit Sub
Else
List1.Clear
Combo2.Clear
Rsb.Close
Rsb.Open "Login", Con, adOpenStatic, adLockPessimistic, adCmdTable
Do While Not Rsb.EOF
Combo2.AddItem Rsb!登录姓名
List1.AddItem Rsb!登录姓名
Rsb.MoveNext
Loop
End If
Else
MsgBox "更改密码与确认密码不相符或空!"
End If
End Sub
Private Sub Form_Load()
Call ResizeInit(Me)
Set CmdExe = New ADODB.Command
CmdExe.ActiveConnection = Con
If Permission = 0 Then
Set Rsb = New ADODB.Recordset
Rsb.Open "Login", Con, adOpenStatic, adLockPessimistic, adCmdTable
Combo1.Clear
Do While Not Rsb.EOF
Combo1.AddItem Rsb!登录姓名
Combo2.AddItem Rsb!登录姓名
List1.AddItem Rsb!登录姓名
Rsb.MoveNext
Loop
Command2.Enabled = True
Combo3.AddItem "管理员", 0
Combo3.AddItem "普通用户", 1
Else
Combo1.AddItem LoginUser, 0
Combo2.AddItem LoginUser, 0
Combo3.AddItem "普通用户", 0
Combo1.ListIndex = 0
Combo2.ListIndex = 0
Combo3.ListIndex = 0
End If
End Sub
Private Sub Form_Resize()
Call ResizeForm(Me) '窗体改变时,控件随之变化
With Combo1
.Top = Label1.Top
.Left = Text2.Left
.Width = Text2.Width
End With
With Combo2
.Top = Label10.Top
.Left = Text6.Left
.Width = Text6.Width
End With
With Combo3
.Top = Label11.Top
.Left = Text6.Left
.Width = Text6.Width
End With
End Sub
Private Sub List1_Click()
If List1.ListIndex > -1 Then
Rsb.Move List1.ListIndex, adBookmarkFirst
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -