📄 用户管理.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form 用户管理
BorderStyle = 3 'Fixed Dialog
Caption = "用户管理"
ClientHeight = 5190
ClientLeft = 45
ClientTop = 435
ClientWidth = 6975
Icon = "用户管理.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5190
ScaleWidth = 6975
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame1
Height = 5115
Left = 60
TabIndex = 0
Top = 0
Width = 6855
Begin VB.Frame Frame3
Height = 2055
Left = 3360
TabIndex = 16
Top = 2460
Visible = 0 'False
Width = 3435
Begin VB.TextBox Text6
Height = 315
IMEMode = 3 'DISABLE
Left = 1320
PasswordChar = "*"
TabIndex = 5
Top = 1140
Width = 1695
End
Begin VB.TextBox Text5
Height = 315
IMEMode = 3 'DISABLE
Left = 1320
PasswordChar = "*"
TabIndex = 4
Top = 540
Width = 1695
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "确认新密码:"
Height = 180
Left = 180
TabIndex = 18
Top = 1200
Width = 1080
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "新密码:"
Height = 180
Left = 300
TabIndex = 17
Top = 600
Width = 720
End
End
Begin VB.CommandButton Command6
Caption = "取消修改"
Enabled = 0 'False
Height = 375
Left = 2280
TabIndex = 8
Top = 4680
Width = 975
End
Begin VB.CommandButton Command5
Caption = "确定修改"
Enabled = 0 'False
Height = 375
Left = 1320
TabIndex = 7
Top = 4680
Width = 975
End
Begin VB.CommandButton Command4
Caption = "返回"
Height = 375
Left = 5700
TabIndex = 15
Top = 4680
Width = 975
End
Begin VB.CommandButton Command3
Caption = "修改"
Height = 375
Left = 360
TabIndex = 6
Top = 4680
Width = 975
End
Begin VB.CommandButton Command2
Caption = "删除"
Height = 375
Left = 4620
TabIndex = 14
Top = 4680
Width = 975
End
Begin VB.CommandButton Command1
Caption = "添加"
Height = 375
Left = 3540
TabIndex = 9
Top = 4680
Width = 975
End
Begin VB.Frame Frame2
Height = 2055
Left = 60
TabIndex = 10
Top = 2460
Width = 3315
Begin VB.ComboBox Combo1
Height = 300
ItemData = "用户管理.frx":030A
Left = 1080
List = "用户管理.frx":0314
Style = 2 'Dropdown List
TabIndex = 2
Top = 960
Width = 1995
End
Begin VB.TextBox Text3
Height = 300
IMEMode = 3 'DISABLE
Left = 1080
PasswordChar = "*"
TabIndex = 3
Top = 1560
Width = 1995
End
Begin VB.TextBox Text1
Height = 300
Left = 1080
TabIndex = 1
Top = 300
Width = 1995
End
Begin VB.Label Label3
Caption = "密码:"
Height = 195
Left = 420
TabIndex = 13
Top = 1620
Width = 675
End
Begin VB.Label Label2
Caption = "权限:"
Height = 195
Left = 420
TabIndex = 12
Top = 1020
Width = 615
End
Begin VB.Label Label1
Caption = "姓名:"
Height = 195
Left = 420
TabIndex = 11
Top = 360
Width = 555
End
End
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "用户管理.frx":032A
Height = 2235
Left = 60
TabIndex = 19
Top = 180
Width = 6675
_ExtentX = 11774
_ExtentY = 3942
_Version = 393216
HeadLines = 1
RowHeight = 15
FormatLocked = -1 'True
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = "user"
Caption = "姓名"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = "qx"
Caption = "权限"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
AllowRowSizing = 0 'False
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 2280
Top = 4440
Visible = 0 'False
Width = 1995
_ExtentX = 3519
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
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 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=学生教材管理系统.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=学生教材管理系统.mdb;Persist Security Info=False"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select * from 用户管理"
Caption = "Adodc1"
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
End
Attribute VB_Name = "用户管理"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
Text1.Text = "": Text3.Text = "": Text5.Text = "": Text6.Text = ""
Text1.SetFocus
Command1.Enabled = False
Command3.Enabled = False
Command2.Enabled = False
Command5.Enabled = True
Command6.Enabled = True
Command5.Caption = "确定添加"
Command6.Caption = "取消添加"
Adodc1.Recordset.AddNew
End Sub
Private Sub Command2_Click()
Dim aa As Integer
aa = MsgBox("确定删除?", 32 + 1)
If aa = 1 Then
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveFirst
Text1.Text = Adodc1.Recordset.Fields("user")
Combo1.Text = Adodc1.Recordset.Fields("qx")
End If
End Sub
Private Sub Command3_Click()
Text1.SetFocus
Frame3.Visible = True
Command5.Enabled = True
Command6.Enabled = True
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
Text3.Text = ""
End Sub
Private Sub Command4_Click()
Unload Me
End Sub
Private Sub Command5_Click()
If Command5.Caption = "确定修改" Then
If Text3.Text <> Adodc1.Recordset.Fields("password") Then
MsgBox "旧密码错误,请重新输入!", vbOKOnly + vbInformation: Text3.Text = "": Text3.SetFocus
Else
If Text5.Text <> Text6.Text Then
MsgBox "两次输入的密码不一致,请重新输入!", vbOKOnly + vbInformation: Text5.SetFocus: Text5.Text = ""
Text6.Text = ""
Else
Adodc1.Recordset.Fields("password") = Trim(Text5.Text)
Text3.Text = ""
Frame3.Visible = False
Command1.Enabled = True
Command2.Enabled = True
Command5.Enabled = False
Command6.Enabled = False
Command3.Enabled = True
End If
Text5.Text = ""
Text6.Text = ""
End If
End If
If Command5.Caption = "确定添加" Then
If Trim(Text1.Text) = "" Then
MsgBox ("用户名不能为空,请输入用户名!"): Text1.SetFocus
Else
Adodc1.Recordset.Fields("user") = Trim(Text1.Text)
Adodc1.Recordset.Fields("qx") = Trim(Combo1.Text)
Adodc1.Recordset.Fields("password") = Trim(Text3.Text)
Adodc1.Recordset.Update
Command3.Enabled = True
Command2.Enabled = True
Command1.Enabled = True
Command5.Caption = "确定修改"
Command6.Caption = "取消修改"
Command5.Enabled = False
Command6.Enabled = False
End If
End If
End Sub
Private Sub Command6_Click()
If Command6.Caption = "取消修改" Then
Command1.Enabled = True
Command2.Enabled = True
Command5.Enabled = False
Command6.Enabled = False
Command3.Enabled = True
Text3.Text = ""
Text5.Text = ""
Text6.Text = ""
Frame3.Visible = False
End If
If Command6.Caption = "取消添加" Then
Command3.Enabled = True
Command2.Enabled = True
Command1.Enabled = True
Command5.Enabled = False
Command6.Enabled = False
Command5.Caption = "确定修改"
Command6.Caption = "取消修改"
Text3.Text = ""
Text1.Text = ""
Frame3.Visible = False
Adodc1.Refresh
End If
End Sub
Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
On Error Resume Next
Text1.Text = Trim(Adodc1.Recordset.Fields(0))
Combo1.Text = Trim(Adodc1.Recordset.Fields(1))
End Sub
Private Sub Form_Activate()
Text1.Text = Trim(Adodc1.Recordset.Fields(0))
Combo1.Text = Trim(Adodc1.Recordset.Fields(1))
End Sub
Private Sub Form_Unload(Cancel As Integer)
Adodc1.Refresh
主窗体.Enabled = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -