📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form frmlogin
Caption = "登录"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 450
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3090
ScaleWidth = 4680
Begin VB.CommandButton Command2
Caption = "取消"
Height = 495
Left = 2760
TabIndex = 6
Top = 2400
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "确认"
Height = 495
Left = 480
TabIndex = 5
Top = 2400
Width = 1215
End
Begin VB.TextBox txtpassword
Height = 495
IMEMode = 3 'DISABLE
Left = 1680
PasswordChar = "*"
TabIndex = 4
Top = 1560
Width = 2295
End
Begin VB.TextBox txtusername
Height = 495
Left = 1680
TabIndex = 3
Top = 960
Width = 2295
End
Begin VB.Label Label3
Caption = "用户密码"
Height = 375
Left = 600
TabIndex = 2
Top = 1680
Width = 735
End
Begin VB.Label Label2
Caption = "用户名"
Height = 375
Left = 600
TabIndex = 1
Top = 960
Width = 735
End
Begin VB.Label Label1
Caption = "学生管理系统"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1440
TabIndex = 0
Top = 360
Width = 1935
End
End
Attribute VB_Name = "frmlogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim txtsql As String, mrc As ADODB.Recordset, msgtext As String
Dim micount
Public ok
Private Sub Command1_Click()
If Trim(txtusername.Text = "") Then
MsgBox "用户名不能为为空,请重新输入!", vbOKOnly + vbExclamation, "警告"
txtusername.SelStart = 0
txtusername.SelLength = Len(txtusername.Text)
txtusername.SetFocus
Exit Sub
Else
txtsql = "select * from user_info where user_id='" & Trim(txtusername.Text) & " '"
Set mrc = executesql(txtsql, msgtext)
If mrc.EOF = True Then
MsgBox "用户名出错,请重新输入!", vbOKOnly + vbExclamation, "警告"
txtusername.SetFocus
Exit Sub
Else
If Trim(mrc.Fields(1)) = Trim(txtpassword.Text) Then
ok = True
mrc.Close
username = Trim(txtusername.Text)
frmmain.Show
Unload Me
Else
micount = micount + 1
If micount = 3 Then
MsgBox "尝试数超过3次,你无权使用本程序", vbExclamation, "警告"
End
End If
MsgBox "密码错误,请重新输入!", vbOKOnly + vbExclamation, "警告"
txtpassword.Text = ""
txtpassword.SetFocus
Exit Sub
End If
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -