📄 yhgl.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form glyh
Caption = "管理员"
ClientHeight = 4545
ClientLeft = 60
ClientTop = 450
ClientWidth = 4665
LinkTopic = "Form1"
ScaleHeight = 4545
ScaleWidth = 4665
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame1
Height = 4695
Left = -120
TabIndex = 0
Top = -120
Width = 4815
Begin VB.Frame Frame3
Height = 2895
Left = 120
TabIndex = 7
Top = 600
Width = 4575
Begin VB.CommandButton Command5
Caption = "取消"
Height = 495
Left = 2760
TabIndex = 13
Top = 2280
Width = 735
End
Begin VB.CommandButton Command4
Caption = "确定"
Height = 495
Left = 1320
TabIndex = 12
Top = 2280
Width = 735
End
Begin VB.TextBox Text1
Height = 270
IMEMode = 3 'DISABLE
Index = 2
Left = 2400
PasswordChar = "*"
TabIndex = 11
Top = 1425
Width = 1575
End
Begin VB.TextBox Text1
Height = 270
IMEMode = 3 'DISABLE
Index = 1
Left = 2400
PasswordChar = "*"
TabIndex = 10
Top = 945
Width = 1575
End
Begin VB.TextBox Text1
Height = 270
Index = 0
Left = 2400
TabIndex = 9
Top = 465
Width = 1575
End
Begin VB.ComboBox Combo1
Height = 300
ItemData = "yhgl.frx":0000
Left = 2400
List = "yhgl.frx":000A
Style = 2 'Dropdown List
TabIndex = 8
Top = 1800
Width = 1695
End
Begin VB.Label Label7
Caption = "确认密码 :"
Height = 375
Left = 720
TabIndex = 18
Top = 1373
Width = 1335
End
Begin VB.Label Label3
Caption = "新用户密码: "
Height = 375
Left = 720
TabIndex = 17
Top = 893
Width = 1215
End
Begin VB.Label Label2
Caption = "新用户名 :"
Height = 255
Left = 720
TabIndex = 16
Top = 473
Width = 1455
End
Begin VB.Label Label8
Caption = "用户权限 :"
Height = 375
Left = 720
TabIndex = 15
Top = 1763
Width = 1215
End
Begin VB.Label Label4
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2520
TabIndex = 14
Top = 360
Width = 1575
End
End
Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1
Height = 2415
Left = 600
TabIndex = 5
Top = 960
Width = 3735
_ExtentX = 6588
_ExtentY = 4260
_Version = 393216
HighLight = 2
FillStyle = 1
End
Begin VB.Frame Frame2
Height = 975
Left = 120
TabIndex = 1
Top = 3600
Width = 4575
Begin VB.CommandButton Command3
Caption = " 删除 "
Height = 495
Left = 3360
TabIndex = 4
Top = 240
Width = 1095
End
Begin VB.CommandButton Command2
Caption = "修改"
Height = 495
Left = 1800
TabIndex = 3
Top = 240
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "添加"
Height = 495
Left = 240
TabIndex = 2
Top = 240
Width = 1095
End
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "用户信息"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 1920
TabIndex = 6
Top = 240
Width = 960
End
End
End
Attribute VB_Name = "glyh"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim user As ADODB.Recordset
Dim rs As ADODB.Recordset
Dim flag As Boolean
Private Sub Command1_Click()
Dim i As Integer
Frame3.Visible = True
'Text1(0).SetFocus
For i = 0 To 2
Text1(i).Text = ""
Next
For i = 0 To 2
Text1(i).Enabled = True
Next
Label5.Caption = "添加用户信息"
Frame2.Visible = False
flag = True
End Sub
Private Sub Command2_Click()
If rs.EOF Then
MsgBox "请选择要修改的用户", 0, "系统提示"
Exit Sub
End If
Frame3.Visible = True
Label5.Caption = "修改用户信息"
Text1(0).Text = rs.Fields(1)
Text1(1).Text = rs.Fields(2)
Text1(2).Text = rs.Fields(2)
Frame2.Visible = False
Dim i As Integer
For i = 0 To 2
Text1(i).Enabled = False
Next i
flag = False
End Sub
Private Sub Command3_Click()
If rs.EOF Then
MsgBox "请选择要删除的用户", 0, "系统提示"
Exit Sub
End If
Frame2.Visible = False
Frame3.Visible = False
'If Text1(0).Text = "" Then
'MsgBox "请输入员工ID号", 0, "系统提示"
If MsgBox("你真要删除账号吗?", vbYesNo, "信息提示") = vbYes Then
Ex_Sql "delete * from usertab where User_Id='" & rs.Fields(1) & "'"
End If
Frame2.Visible = True
Frame3.Visible = False
With MSFlexGrid1
.Cols = 4
.TextMatrix(0, 1) = "用户账号"
.TextMatrix(0, 2) = "用户密码"
.TextMatrix(0, 3) = "用户权限"
End With
Set rs = Ex_Sql("select User_Id ,User_Pass ,User_Qx from usertab")
Call module1.showdata(rs, MSFlexGrid1)
End Sub
Private Sub Command4_Click()
Label5.Visible = True
If flag Then
Dim user As ADODB.Recordset
If Text1(0).Text = "" Then
MsgBox "请输入员工ID号", 0, "系统提示"
Text1(0).SetFocus
Exit Sub
End If
Set user = Ex_Sql("select * from usertab where User_Id ='" & Text1(0).Text & "'")
If Not (user.EOF) Then
MsgBox "该账号以存在!", 0, "系统提示"
Exit Sub
End If
If Text1(1).Text <> Text1(2).Text Then
MsgBox "确认密码不一致!", 0, "信息提示"
Text1(1).Text = ""
Text1(2).Text = ""
Text1(1).SetFocus
Exit Sub
End If
If Combo1.Text = "" Then
MsgBox "你还没有设置用户权限!", 0, "信息提示"
Exit Sub
End If
Ex_Sql "insert into usertab(User_Id,User_Pass,User_Qx) values ('" & Trim(LTrim(Text1(0).Text)) & "','" & Trim(LTrim(Text1(1).Text)) & "','" & Combo1.Text & "')"
MsgBox "操作成功!", 0, "信息提示"
'修改
Else
If Combo1.Text = "" Then
MsgBox "请设置用户权限!", 0, "信息提示"
Exit Sub
End If
Ex_Sql "update usertab set User_Qx='" & Combo1.Text & "' where User_Id ='" & Text1(0).Text & "'"
MsgBox "操作成功!", 0, "信息提示"
End If
Set rs = Ex_Sql("select User_Id ,User_Pass ,User_Qx from usertab")
Call module1.showdata(rs, MSFlexGrid1)
Dim i As Integer
For i = 0 To 2
Text1(i).Text = ""
Next
Frame3.Visible = False
Frame2.Visible = True
End Sub
Private Sub Command5_Click()
Label5.Visible = True
Frame2.Visible = True
For i = 0 To 2
Text1(i).Text = ""
Next
Frame3.Visible = False
Label5.Caption = "用户信息"
End Sub
Private Sub Form_Load()
Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2
With MSFlexGrid1
.Cols = 4
.TextMatrix(0, 1) = "用户账号"
.TextMatrix(0, 2) = "用户密码"
.TextMatrix(0, 3) = "用户权限"
End With
Set rs = Ex_Sql("select User_Id ,User_Pass ,User_Qx from usertab")
Call module1.showdata(rs, MSFlexGrid1)
Frame3.Visible = False
Frame2.Visible = True
End Sub
Private Sub Form_Unload(Cancel As Integer)
MainMDI.Enabled = True
End Sub
Private Sub MSFlexGrid1_Click()
If MSFlexGrid1.Col = 1 Then
Set rs = Ex_Sql("select * from usertab where User_Id='" & MSFlexGrid1.Text & "'")
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -