📄 frm_gly.frm
字号:
VERSION 5.00
Begin VB.Form frm_gly
BorderStyle = 1 'Fixed Single
Caption = "操作员设置"
ClientHeight = 3075
ClientLeft = 45
ClientTop = 330
ClientWidth = 5805
LinkTopic = "Form1"
ScaleHeight = 3075
ScaleWidth = 5805
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame1
Height = 2625
Left = -15
TabIndex = 3
Top = 0
Width = 5745
Begin VB.TextBox Text3
BackColor = &H00FFFFFF&
Height = 360
IMEMode = 3 'DISABLE
Left = 2010
MaxLength = 50
PasswordChar = "*"
TabIndex = 6
Top = 2070
Width = 2880
End
Begin VB.TextBox Text2
BackColor = &H00FFFFFF&
Height = 345
IMEMode = 3 'DISABLE
Left = 2010
MaxLength = 50
TabIndex = 5
Top = 1545
Width = 2880
End
Begin VB.TextBox Text1
BackColor = &H00FFFFFF&
Height = 345
Left = 2010
TabIndex = 4
Top = 1020
Width = 2880
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "操作员 密 码 确 认"
Height = 1515
Left = 1395
TabIndex = 8
Top = 1080
Width = 1005
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "请输入操作员代号和密码"
BeginProperty Font
Name = "华文行楷"
Size = 18
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 405
Left = 270
TabIndex = 7
Top = 270
Width = 4215
End
End
Begin VB.CommandButton Command3
Caption = "退出"
Height = 375
Left = 3810
MaskColor = &H8000000B&
Style = 1 'Graphical
TabIndex = 2
Top = 2655
Width = 1575
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 375
Left = 360
MaskColor = &H8000000B&
Style = 1 'Graphical
TabIndex = 1
Top = 2655
Width = 1575
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 2085
MaskColor = &H8000000B&
Style = 1 'Graphical
TabIndex = 0
Top = 2655
Width = 1575
End
End
Attribute VB_Name = "frm_gly"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Activate()
Text1.SetFocus 'text1获得焦点
End Sub
Private Sub Form_Unload(Cancel As Integer)
Frm_main.Show
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text2.SetFocus '回车text2获得焦点
End Sub
Private Sub text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text3.SetFocus '回车text3获得焦点
End Sub
Private Sub Text3_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Command1.SetFocus '回车Command1获得焦点
End Sub
Private Sub Command1_Click()
Dim rs As New ADODB.Recordset
Dim rs1 As New ADODB.Recordset
'保存操作员及密码
If Text1.Text <> "" Then
If Text2.Text <> "" And Text3.Text <> "" And Text2.Text = Text3.Text Then
rs1.Open "select * from tb_gly where 管理员='" & Text1.Text & "'", cnn, adOpenKeyset, adLockOptimistic
If rs1.RecordCount > 0 Then
MsgBox "该管理员已存在!", , "学生订票管理系统"
Text1.Text = "": Text2.Text = "": Text3.Text = ""
Exit Sub
End If
rs1.Close
rs.Open "select * from tb_gly", cnn, adOpenKeyset, adLockOptimistic
rs.AddNew
rs.Fields("管理员") = Text1.Text
rs.Fields("密码") = Text2.Text
rs.Update
rs.Close
Text1.Text = "": Text2.Text = "": Text3.Text = ""
MsgBox "操作员设置成功!", , "系统提示"
'MsgBox 函数在对话框中显示消息,等待用户单击按钮,并返回一个 Integer 告诉用户单击哪一个按钮。
ElseIf Text3.Text = "" Then
MsgBox "请输入确认密码", , "系统提示"
Text3.SetFocus
ElseIf Text2.Text <> Text3.Text Then
MsgBox "两次输入的密码不相同", , "系统提示"
Text2.Text = ""
Text3.Text = ""
Text2.SetFocus
End If
Else
MsgBox "请输入操作员!", , "系统提示"
End If
End Sub
Private Sub Command2_Click()
Text1.Text = "": Text2.Text = "": Text3.Text = ""
End Sub
Private Sub Command3_Click()
Unload Me
Frm_main.Show
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -