📄 frm_yhgl.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form Frm_yhgl
Caption = "用户管理"
ClientHeight = 1980
ClientLeft = 60
ClientTop = 345
ClientWidth = 5880
Icon = "Frm_yhgl.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
ScaleHeight = 1980
ScaleWidth = 5880
StartUpPosition = 2 '屏幕中心
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 1680
Top = 3045
Width = 2040
_ExtentX = 3598
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
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 = "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
Begin VB.Frame Frame4
Caption = "用户设置"
Height = 915
Left = 255
TabIndex = 17
Top = 135
Width = 5400
Begin VB.TextBox Text6
DataField = "操作员姓名"
DataSource = "Adodc1"
Height = 300
Left = 1200
TabIndex = 19
Top = 375
Width = 1440
End
Begin VB.TextBox Text5
DataField = "密码"
DataSource = "Adodc1"
Height = 300
IMEMode = 3 'DISABLE
Left = 3825
PasswordChar = "*"
TabIndex = 18
Top = 360
Width = 1440
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "操作员姓名:"
Height = 180
Left = 180
TabIndex = 21
Top = 435
Width = 1080
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "密 码:"
Height = 180
Left = 2715
TabIndex = 20
Top = 450
Width = 1080
End
End
Begin VB.Frame Frame3
Height = 705
Left = 2280
TabIndex = 10
Top = 1080
Width = 3360
Begin VB.CommandButton Command10
Caption = "退出"
Height = 350
Left = 2745
TabIndex = 16
Top = 225
Width = 550
End
Begin VB.CommandButton Command9
Caption = "删除"
Height = 350
Left = 2205
TabIndex = 15
Top = 225
Width = 550
End
Begin VB.CommandButton Command8
Caption = "修改"
Height = 350
Left = 1665
TabIndex = 14
Top = 225
Width = 550
End
Begin VB.CommandButton Command7
Caption = "取消"
Height = 350
Left = 1125
TabIndex = 13
Top = 225
Width = 550
End
Begin VB.CommandButton Command6
Caption = "保存"
Height = 350
Left = 585
TabIndex = 12
Top = 225
Width = 550
End
Begin VB.CommandButton Command5
Caption = "添加"
Height = 350
Left = 45
TabIndex = 11
Top = 225
Width = 550
End
End
Begin VB.Frame Frame2
Height = 705
Left = 240
TabIndex = 5
Top = 1080
Width = 2070
Begin VB.CommandButton Command4
Caption = ">|"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 350
Left = 1485
TabIndex = 9
Top = 225
Width = 500
End
Begin VB.CommandButton Command3
Caption = ">"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 350
Left = 1005
TabIndex = 8
Top = 225
Width = 500
End
Begin VB.CommandButton Command2
Caption = "<"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 350
Left = 525
TabIndex = 7
Top = 225
Width = 500
End
Begin VB.CommandButton Command1
Caption = "|<"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 350
Left = 45
TabIndex = 6
Top = 225
Width = 500
End
End
Begin VB.Frame Frame1
Caption = "用户权限设置"
Height = 900
Left = 255
TabIndex = 0
Top = 150
Width = 5400
Begin VB.TextBox Text4
Height = 300
IMEMode = 3 'DISABLE
Left = 3810
PasswordChar = "*"
TabIndex = 2
Top = 345
Width = 1425
End
Begin VB.TextBox Text3
Height = 300
Left = 1260
TabIndex = 1
Top = 330
Width = 1350
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "密 码:"
Height = 180
Left = 2685
TabIndex = 4
Top = 375
Width = 1080
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "操作员姓名:"
Height = 180
Left = 180
TabIndex = 3
Top = 405
Width = 1080
End
End
End
Attribute VB_Name = "Frm_yhgl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim KeyCode As String
Private Sub Command10_Click() '退出
Unload Me
Frm_czygl.Show '显示操作员管理窗体
End Sub
Private Sub Command1_Click() '“|<”按钮
Frame2.Visible = True
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.MoveFirst
Else
MsgBox "没有记录!", , "系统提示"
End If
End Sub
Private Sub Command2_Click() '“<”按钮
Frame2.Visible = True
' Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.MovePrevious
If Adodc1.Recordset.BOF Then Adodc1.Recordset.MoveFirst
Else
MsgBox "没有记录!", , "系统提示"
End If
End Sub
Private Sub Command3_Click() '“>”按钮
Frame2.Visible = True
' Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF Then Adodc1.Recordset.MoveLast
Else
MsgBox "没有记录!", , "系统提示"
End If
End Sub
Private Sub Command4_Click() '“>|”按钮
Frame2.Visible = True
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.MoveLast
Else
MsgBox "没有记录!", , "系统提示"
End If
End Sub
Private Sub Command5_Click() '添加
Frame1.Visible = True
Frame4.Visible = False
Text3.SetFocus
Command6.Enabled = True '保存按钮可用
Command7.Enabled = True '取消按钮可用
Command5.Enabled = False '添加按钮不可用
Command8.Enabled = False '修改按钮不可用
Command9.Enabled = False '删除按钮不可用
End Sub
Private Sub Command6_Click() '保存
Set adors = cn.Execute("insert into tab_power (操作员姓名,密码) values('" & Text3 & "','" & Text4 & "') ")
MsgBox "数据保存成功!", , "系统提示"
Unload Me
Adodc1.Refresh
Frm_yhgl.Show
cn.Close
End Sub
Private Sub Command7_Click() '取消
'清空文本框
Text3.Text = ""
Text4.Text = ""
Text3.SetFocus
'设置控件状态
Command6.Enabled = False '保存按钮可用
Command7.Enabled = False '取消按钮可用
Command5.Enabled = True '添加按钮不可用
Command8.Enabled = True '修改按钮不可用
Command9.Enabled = True '删除按钮不可用
Frame4.Visible = True
Frame1.Visible = False
End Sub
Private Sub Command8_Click() '修改
Adodc1.Recordset.UpdateBatch
MsgBox "信息修改成功!", , "系统提示"
Adodc1.Refresh
End Sub
Private Sub Command9_Click() '删除
Dim myval As String
Adodc1.RecordSource = "select * from tab_power"
If Adodc1.Recordset.RecordCount > 0 Then
myval = MsgBox("确定删除吗?", vbYesNo, "系统提示")
If myval = vbYes Then
Adodc1.Recordset.Delete
Unload Me
Adodc1.Refresh
Frm_yhgl.Show
Else
End If
Else
MsgBox "数据库中没有记录要删除", , "系统提示"
End If
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then '按回车键Text2获得焦点
Text2.SetFocus
End If
End Sub
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then '按回车键Text3获得焦点
Text3.SetFocus
End If
End Sub
Private Sub Form_Load()
'自动识别路径
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_wygl.mdb;Persist Security Info=False"
Adodc1.RecordSource = "select * from tab_power "
Adodc1.Refresh
'设置控件状态
Command6.Enabled = False '保存按钮不可用
Command7.Enabled = False '取消按钮不可用
End Sub
Private Sub Text3_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then '按回车键Text4获得焦点
Text4.SetFocus
End If
End Sub
Private Sub Text4_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then Command6.SetFocus
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -