📄 pass.frm
字号:
VERSION 5.00
Begin VB.Form pass
BorderStyle = 5 'Sizable ToolWindow
Caption = "登录窗口"
ClientHeight = 3315
ClientLeft = 60
ClientTop = 285
ClientWidth = 5295
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 3315
ScaleWidth = 5295
ShowInTaskbar = 0 'False
Begin VB.Frame Frame1
Height = 3255
Index = 0
Left = 120
TabIndex = 0
Top = 0
Width = 5055
Begin VB.TextBox Text2
Height = 495
IMEMode = 3 'DISABLE
Left = 2280
PasswordChar = "*"
TabIndex = 4
Top = 1320
Width = 2175
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
IMEMode = 3 'DISABLE
Left = 2280
PasswordChar = "*"
TabIndex = 3
Top = 600
Width = 2175
End
Begin VB.CommandButton Command1
Caption = "登录系统(&O)"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 600
TabIndex = 2
Top = 2160
Width = 1815
End
Begin VB.CommandButton Command2
Caption = "退出系统(&C)"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 2640
TabIndex = 1
Top = 2160
Width = 1815
End
Begin VB.Label Label1
Caption = "密 码"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 600
TabIndex = 6
Top = 1440
Width = 1215
End
Begin VB.Label Label2
Caption = "用 户 名"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 600
TabIndex = 5
Top = 600
Width = 1215
End
End
End
Attribute VB_Name = "pass"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If Text1.Text = "" Then
MsgBox "请输入用户名!", vbOKOnly, "提示!"
Text1.SetFocus
Else
If Text2.Text = "" Then
MsgBox "请输入密码!", vbOKOnly, "提示!"
Text2.SetFocus
Else
txtSQL = "select * from user where 姓名='" & Text1.Text & "'" '查询指定用户名的记录
Set dream = ExecuteSQL(txtSQL, Msgtext) '执行查询语句
If dream.EOF = True Then
MsgBox "用户不存在,请重新输入用户名!", vbOKOnly + vbExclamation, "提示!"
Text1.SetFocus
Text1.Text = ""
Else
If Trim(dream.Fields(1)) = Trim(Text2.Text) Then '判断密码是否正确
OK = True
studentmdi.Show
pass.Hide
login.Hide
dream.Close
Else
studentmdi.Hide
MsgBox "输入密码不正确,请重新输入!", 48, "警告 "
Text2.SetFocus
Text2.Text = ""
End If
End If
c = c + 1 '记载输入密码次数
If c = 3 Then Me.Hide
If OK Then Me.Hide
' Text1.Text = ""
Text2.Text = ""
End If
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Activate()
Text1.SetFocus
Text1.Text = ""
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
Call Command1_Click
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -