📄 f_yhgl.frm
字号:
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 WinXPC_Engine.WindowsXPC WindowsXPC1
Left = 6360
Top = 5520
_ExtentX = 6588
_ExtentY = 1085
ColorScheme = 2
Common_Dialog = 0 'False
End
Begin VB.Line Line6
BorderColor = &H80000001&
X1 = 120
X2 = 6240
Y1 = 4800
Y2 = 4800
End
Begin VB.Line Line5
BorderColor = &H80000009&
X1 = 120
X2 = 6240
Y1 = 4815
Y2 = 4815
End
Begin VB.Line Line4
BorderColor = &H80000001&
X1 = 120
X2 = 6240
Y1 = 2640
Y2 = 2640
End
Begin VB.Line Line3
BorderColor = &H80000009&
X1 = 120
X2 = 6240
Y1 = 2655
Y2 = 2655
End
Begin VB.Label Label6
Alignment = 2 'Center
Caption = "普通用户"
ForeColor = &H00000000&
Height = 255
Left = 720
TabIndex = 17
Top = 1750
Visible = 0 'False
Width = 1335
End
Begin VB.Line Line2
BorderColor = &H80000009&
X1 = 120
X2 = 6240
Y1 = 1455
Y2 = 1455
End
Begin VB.Line Line1
BorderColor = &H80000001&
X1 = 120
X2 = 6240
Y1 = 1440
Y2 = 1440
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "用户名"
Height = 180
Left = 2160
TabIndex = 15
Top = 1740
Width = 540
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "拼音码"
Height = 180
Left = 4200
TabIndex = 14
Top = 1740
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = " 代码"
Height = 180
Left = 120
TabIndex = 13
Top = 2220
Width = 540
End
Begin VB.Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = " 口令"
Height = 180
Left = 2160
TabIndex = 12
Top = 2220
Width = 540
End
Begin VB.Label Label5
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = " 确认"
Height = 180
Left = 4200
TabIndex = 11
Top = 2220
Width = 540
End
End
Attribute VB_Name = "F_YHGL"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command2_Click()
If Text3.Text = Text4.Text Then
On Error GoTo ERR1
With Adodc1
.Recordset.AddNew
.Recordset("代码") = Text2.Text
.Recordset("用户") = Text1.Text
.Recordset("拼音码") = Text5.Text
.Recordset("口令") = Text4.Text
.Recordset("权限") = Label6.Caption
.Recordset("权限代码") = Text6.Text
.Recordset.Update
End With
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Command2.Enabled = False
Option2.Value = True
MsgBox "用户添加成功!", vbOKOnly + vbInformation
Text1.SetFocus
Exit Sub
Else
Text4.Text = ""
MsgBox "口令确认错误!", vbOKOnly + vbInformation
Text4.SetFocus
Exit Sub
End If
ERR1:
MsgBox "有重复代码或者信息未填写完整!", vbOKOnly + vbInformation
Text1.SetFocus
End Sub
Private Sub Command2_GotFocus()
Text1.BackColor = &HFFFFFF
Text2.BackColor = &HFFFFFF
Text3.BackColor = &HFFFFFF
Text4.BackColor = &HFFFFFF
End Sub
Private Sub Command3_Click()
On Error GoTo ERR1
Adodc2.ConnectionString = Conn
Adodc2.RecordSource = "SELECT COUNT(*) AS 数量 FROM 操作员字典"
Adodc2.Refresh
UserSL = Adodc2.Recordset.Fields("数量")
If UserSL <> 1 Then
Dim intAnswer As Integer
intAnswer = MsgBox("确认删除此用户吗?", vbYesNo + vbQuestion)
If intAnswer = vbYes Then
With Adodc1.Recordset
.Delete
.UpdateBatch
If .RecordCount <> 0 Then
.MoveFirst
End If
End With
Command3.Enabled = False
End If
Exit Sub
Else
MsgBox "最后一个用户禁止删除!", vbOKOnly + vbInformation
Command3.Enabled = False
Exit Sub
End If
ERR1:
MsgBox "系统配置错误!无法与服务器连接!", vbOKOnly + vbInformation
F_LONG.UserPower = "A"
Unload Me
F_YCSZ.Show
End Sub
Private Sub Command4_Click()
If Text1.Text <> "" Or Text2.Text <> "" Or Text3.Text <> "" Or Text4.Text <> "" Then
Command2.Enabled = False
Text1.SetFocus
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Else
Unload Me
End If
End Sub
Private Sub DataGrid1_Click()
Text6.Text = ""
Text6.Text = Adodc1.Recordset!权限代码
If Text6.Text = "A" Then
Label6.Visible = True
Label6.Caption = "【超级用户】"
Label6.ForeColor = &HFF&
Else
Label6.Visible = True
Label6.Caption = "【普通用户】"
Label6.ForeColor = &H800000
End If
Command3.Enabled = True
End Sub
Private Sub DataGrid1_DblClick()
Command3_Click
End Sub
Private Sub DataGrid1_LostFocus()
Label6.Visible = False
End Sub
Private Sub Form_Load()
WindowsXPC1.InitSubClassing
Adodc1.ConnectionString = Conn
Adodc1.RecordSource = "SELECT * FROM [操作员字典] ORDER BY ID"
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
End Sub
Private Sub Form_Activate()
F_MAIN.StatusBar1.Panels(2).Text = "【当前活动窗口】" & Me.Caption
Text1.SetFocus
End Sub
Private Sub Form_Unload(Cancel As Integer)
F_MAIN.StatusBar1.Panels(2).Text = "目前没有窗口被激活..."
End Sub
Private Sub Option1_Click()
Text1.SetFocus
Text6.Text = "A"
Label6.Caption = "超级用户"
End Sub
Private Sub Option2_Click()
Text1.SetFocus
Text6.Text = "B"
Label6.Caption = "普通用户"
End Sub
Private Sub Text1_GotFocus()
Text1.BackColor = &HC0FFC0
Text2.BackColor = &HFFFFFF
Text3.BackColor = &HFFFFFF
Text4.BackColor = &HFFFFFF
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = Asc(vbCr) Then Text2.SetFocus 'Enter键
End Sub
Private Sub Text1_Change()
Text5.Text = ""
Dim A As Integer
A = Len(Text1.Text)
For I = 1 To A
Text5.Text = Text5.Text & PY(Mid(Text1.Text, I, 1))
Next I
End Sub
Private Sub Text2_GotFocus()
Text1.BackColor = &HFFFFFF
Text2.BackColor = &HC0FFC0
Text3.BackColor = &HFFFFFF
Text4.BackColor = &HFFFFFF
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = Asc(vbCr) Then Text3.SetFocus 'Enter键
End Sub
Private Sub Text3_GotFocus()
Text1.BackColor = &HFFFFFF
Text2.BackColor = &HFFFFFF
Text3.BackColor = &HC0FFC0
Text4.BackColor = &HFFFFFF
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = Asc(vbCr) Then Text4.SetFocus 'Enter键
End Sub
Private Sub Text4_Change()
Command2.Enabled = True
End Sub
Private Sub Text4_GotFocus()
Text1.BackColor = &HFFFFFF
Text2.BackColor = &HFFFFFF
Text3.BackColor = &HFFFFFF
Text4.BackColor = &HC0FFC0
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
If KeyAscii = Asc(vbCr) And Command2.Enabled = True Then Command2_Click 'Enter键
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -