📄 login.frm
字号:
VERSION 5.00
Begin VB.Form login
BackColor = &H00FFFFFF&
BorderStyle = 3 'Fixed Dialog
Caption = "登陆系统"
ClientHeight = 3435
ClientLeft = 45
ClientTop = 450
ClientWidth = 4305
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
Picture = "login.frx":0000
ScaleHeight = 3435
ScaleWidth = 4305
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox Text1
Height = 375
Left = 1800
TabIndex = 1
Text = "zhizuozu"
Top = 1080
Width = 1935
End
Begin VB.ComboBox Combo1
Height = 300
ItemData = "login.frx":35B0B
Left = 1800
List = "login.frx":35B15
TabIndex = 0
Text = "管理员"
Top = 360
Width = 1935
End
Begin VB.TextBox txtPass
DataField = "密码"
Height = 300
IMEMode = 3 'DISABLE
Left = 1800
PasswordChar = "*"
TabIndex = 2
Text = "618"
Top = 1680
Width = 1935
End
Begin VB.CommandButton cmdOK
Caption = "确定"
Height = 495
Left = 600
TabIndex = 3
Top = 2400
Width = 975
End
Begin VB.CommandButton Cmdcancel
Caption = "取消"
Height = 495
Left = 2760
TabIndex = 4
Top = 2400
Width = 975
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "登陆身份:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 0
TabIndex = 7
Top = 360
Width = 1335
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "密码:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 600
TabIndex = 6
Top = 1680
Width = 735
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "用户:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 600
TabIndex = 5
Top = 1080
Width = 735
End
End
Attribute VB_Name = "login"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs1 As New ADODB.Recordset '定义一个数据集对象
Dim rs As New ADODB.Recordset
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Dim sq As String
Dim sq1 As String
Call st(frmLogin.yhm.Text, frmLogin.mm.Text, frmLogin.fwqm.Text)
If Combo1.Text = "管理员" Then
If Text1.Text = "" Then
MsgBox "用户名不能为空"
Text1.SetFocus
Else
If txtPass.Text = "" Then
MsgBox "密码不能为空"
Else
If Text1.Text <> "zhizuozu" Then
MsgBox "用户名错误"
Else
If txtPass.Text <> "618" Then
MsgBox "密码错误"
Else
Unload Me
frmmain.Show
frmmain.用户删除.Enabled = True
frmmain.用户添加.Enabled = True
usecourse.Command9.Enabled = True
usecourse.Command8.Enabled = True
usecourse.Command6.Enabled = True
usekc.Command3.Enabled = True
usekc.Command4.Enabled = True
usekc.Command5.Enabled = True
usestu.Command1.Enabled = True
usestu.Command2.Enabled = True
usestu.Command3.Enabled = True
End If
End If
End If
End If
Else
con.Open
sq1 = "select yhmc,yhmm from yhb where yhmc='" & Text1.Text & "' and yhmm='" & txtPass.Text & "'"
Set rs = con.Execute(sq1)
If rs.BOF Or rs.EOF Then
MsgBox "密码或用户名错误,请您确认后重新输入"
Text1.Text = ""
txtPass.Text = ""
Text1.SetFocus
Else
Unload Me
frmmain.Show
frmmain.用户删除.Enabled = False
frmmain.用户添加.Enabled = False
usecourse.Command9.Enabled = False
usecourse.Command8.Enabled = False
usecourse.Command6.Enabled = False
usekc.Command3.Enabled = False
usekc.Command4.Enabled = False
usekc.Command5.Enabled = False
usestu.Command1.Enabled = False
usestu.Command2.Enabled = False
usestu.Command3.Enabled = False
End If
con.Close
End If
End Sub
Private Sub Form_Load()
login.Move (Screen.Height - login.Height) / 2, (Screen.Width - login.Width) / 2
End Sub
Private Sub txtPass_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Call cmdOK_Click
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -