📄 frmlogin.frm
字号:
VERSION 5.00
Begin VB.Form Frmlogin
BorderStyle = 1 'Fixed Single
Caption = "学籍管理系统登陆"
ClientHeight = 1500
ClientLeft = 45
ClientTop = 435
ClientWidth = 3630
Icon = "Frmlogin.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1500
ScaleWidth = 3630
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton cmdOKCancel
Caption = "取消(&C)"
Height = 330
Index = 1
Left = 2160
Style = 1 'Graphical
TabIndex = 3
Top = 1080
Width = 930
End
Begin VB.CommandButton cmdOKCancel
Caption = "确定(&O)"
Default = -1 'True
Height = 330
Index = 0
Left = 600
Style = 1 'Graphical
TabIndex = 2
Top = 1080
Width = 930
End
Begin VB.TextBox txtPassword
BackColor = &H00FFFFFF&
ForeColor = &H00000000&
Height = 300
IMEMode = 3 'DISABLE
Left = 1080
PasswordChar = "*"
TabIndex = 1
ToolTipText = "请输入登陆密码!"
Top = 540
Width = 2205
End
Begin VB.TextBox txtuser
Height = 300
IMEMode = 3 'DISABLE
Left = 1080
TabIndex = 0
ToolTipText = "请输入登陆的用户名"
Top = 120
Width = 2205
End
Begin VB.Label lblLabels
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "密 码:"
ForeColor = &H00000000&
Height = 180
Index = 1
Left = 360
TabIndex = 5
Top = 600
Width = 720
End
Begin VB.Line Line1
X1 = 0
X2 = 3600
Y1 = 960
Y2 = 960
End
Begin VB.Line Line2
BorderColor = &H80000005&
X1 = 120
X2 = 2880
Y1 = 960
Y2 = 960
End
Begin VB.Label lblLabels
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "用户名:"
ForeColor = &H00000000&
Height = 180
Index = 0
Left = 360
TabIndex = 4
Top = 180
Width = 720
End
End
Attribute VB_Name = "Frmlogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim loginno As Integer
Private Sub cmdOkCancel_Click(Index As Integer)
Select Case Index
Case 0
'On Error Resume Next
'检测txtuser控件
If Trim(txtuser.Text) = "" Then
MsgBox "用户名不能为空!", vbQuestion
txtuser.Text = ""
txtuser.SetFocus
Exit Sub
End If
If InStr(1, Trim(txtuser.Text), "'", 1) Then
MsgBox "用户名中不能包含'号!", vbQuestion
txtuser.Text = ""
txtuser.SetFocus
Exit Sub
End If
Userid = Trim(txtuser.Text)
Userpwd = MD5(Trim(txtPassword.Text))
sqlstr = "select * from UserInfo where UserID='" & Userid & "'"
rs.Open sqlstr, con, 1, 1
If Not rs.EOF Then
If rs("UserPWD") <> Userpwd Then
'密码错误时
MsgBox "您输入的密码不正确!", vbQuestion
Me.Caption = "请输入用户名和密码:"
loginno = loginno + 1
'当错误的密码次数达到3次时,不能登陆,退出!
If loginno = 3 Then
MsgBox "对不起,您不能使用该系统!请与管理员联系。", vbInformation
Unload Me
Exit Sub
End If
txtPassword.SelStart = 0
txtPassword.SelLength = Len(txtPassword.Text)
txtPassword.SetFocus
Else
LoginUser = Userid
LoginPower = rs.Fields(3)
Unload Me
Frmmain.Show
End If
Else
MsgBox "没有您输入的用户名!", 32
txtuser.SelStart = 0
txtuser.SelLength = Len(txtuser.Text)
txtuser.SetFocus
End If
rs.Close: Set rs = Nothing
Case 1
Unload Me
End Select
End Sub
Private Sub Form_Load()
loginno = 0
Me.Show
txtuser.SetFocus
txtuser.Text = "Administrator"
txtPassword.Text = "Administrator"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -