📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form login
Caption = "登陆界面"
ClientHeight = 3135
ClientLeft = 60
ClientTop = 345
ClientWidth = 4395
LinkTopic = "Form1"
ScaleHeight = 3135
ScaleWidth = 4395
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "退出"
Height = 495
Left = 2280
TabIndex = 5
Top = 2280
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 495
Left = 720
TabIndex = 4
Top = 2280
Width = 1095
End
Begin VB.TextBox Text2
DataField = "password"
DataSource = "Adodc1"
Height = 375
IMEMode = 3 'DISABLE
Left = 1200
PasswordChar = "*"
TabIndex = 2
Top = 1560
Width = 2055
End
Begin VB.TextBox Text1
DataField = "userid"
DataSource = "Adodc1"
Height = 375
Left = 1200
TabIndex = 0
Top = 960
Width = 2055
End
Begin VB.Label Label3
Caption = "学 生 档 案 管 理 系 统"
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 240
TabIndex = 6
Top = 240
Width = 3975
End
Begin VB.Label Label2
Caption = "密 码:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 240
TabIndex = 3
Top = 1560
Width = 855
End
Begin VB.Label Label1
Caption = "用户名:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 375
Left = 240
TabIndex = 1
Top = 960
Width = 855
End
End
Attribute VB_Name = "login"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim pwdCount As Integer
Private Sub Command1_Click()
Dim sql As String
Dim rs As ADODB.Recordset
If Trim(Text1.Text = "") Then
MsgBox "没有输入用户名称,请重新输入!", vbOKOnly + vbExclamation, "警告!"
Text1.SetFocus
Else
sql = "select * from username where userid='" & Text1.Text & "'"
Set rs = TransactSQL(sql)
If rs.EOF = True Then
MsgBox "没有这个用户,请重新输入!", vbOKOnly + vbExclamation, "警告!"
Text1.SetFocus
Else
If Trim(rs.Fields(1)) = Trim(Text2.Text) Then
login1.Show
Unload Me
Else
MsgBox "密码不正确,请重新输入!", vbOKOnly + vbExclamation, "警告!"
Text2.SetFocus
Text2.Text = ""
End If
End If
End If
pwdCount = pwdCount + 1
If pwdCount = 3 Then
MsgBox "密码三次错误将退出系统", vbOKOnly + vbExclamation, "警告!"
Unload Me
Exit Sub
End If
End Sub
Private Sub Command2_Click()
Unload Me
Exit Sub
End Sub
Private Sub Form_Load()
pwdCount = 0
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command1_Click
'Command1.SetFocus
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -