📄 frmlogin.frm
字号:
VERSION 5.00
Begin VB.Form frmLogin
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
Caption = "系统登陆"
ClientHeight = 4065
ClientLeft = 45
ClientTop = 330
ClientWidth = 7770
Icon = "frmLogin.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
Picture = "frmLogin.frx":0442
ScaleHeight = 4065
ScaleWidth = 7770
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command2
Cancel = -1 'True
Caption = "退出(&E)"
CausesValidation= 0 'False
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 4635
TabIndex = 6
Top = 3360
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "确定(&O)"
Default = -1 'True
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1875
TabIndex = 5
Top = 3360
Width = 1095
End
Begin VB.TextBox txtPassword
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
IMEMode = 3 'DISABLE
Left = 3315
PasswordChar = "*"
TabIndex = 4
Top = 2205
Width = 1935
End
Begin VB.TextBox txtUser
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3315
TabIndex = 3
Top = 1365
Width = 1935
End
Begin VB.Label Label6
BackStyle = 0 'Transparent
Caption = "123456"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 5280
TabIndex = 8
Top = 2280
Width = 1215
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "yuanhaibo"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 5280
TabIndex = 7
Top = 1440
Width = 1215
End
Begin VB.Image Image1
BorderStyle = 1 'Fixed Single
Height = 735
Left = 120
Picture = "frmLogin.frx":3541
Stretch = -1 'True
Top = 120
Width = 735
End
Begin VB.Line Line1
BorderColor = &H80000002&
BorderWidth = 2
Index = 1
X1 = 1080
X2 = 6720
Y1 = 2880
Y2 = 2880
End
Begin VB.Line Line1
BorderColor = &H80000002&
BorderWidth = 2
Index = 0
X1 = 1080
X2 = 6720
Y1 = 1080
Y2 = 1080
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "密 码:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 1995
TabIndex = 2
Top = 2280
Width = 915
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "用户名:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 1995
TabIndex = 1
Top = 1440
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "欢迎使用商品管理系统,请输入你的用户名和密码:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H8000000D&
Height = 240
Left = 1320
TabIndex = 0
Top = 240
Width = 5865
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
Static i As Integer '控制登陆的次数
Dim Username As String
Dim Password As String
i = i + 1
Username = txtUser
Password = txtPassword
'判断用户名是否存在
sql = "select * from 登陆 where 用户名='" & Username & "'"
Set Db = OpenDatabase(App.Path + "\db1.mdb")
Set RS = Db.OpenRecordset(sql)
If RS.EOF = False Then
Username = RS.Fields("用户名")
ElseIf i < 3 Then
MsgBox "无效的用户名", , "系统登陆"
txtUser.SetFocus
SendKeys "{Home}+{end}"
Exit Sub
Else
MsgBox "多次错误登陆,再见!", , "系统登陆"
End
End If
'判断密码是否正确
sql = "select * from 登陆 where 用户名='" & Username & "' and 密码='" & Password & "'"
Set RS = Db.OpenRecordset(sql)
If RS.EOF = False Then
frmPic.Show
Denglu_name = Username
Load MDIForm1
Unload Me
ElseIf i < 3 Then
MsgBox "无效的密码", , "系统登陆"
txtPassword.SetFocus
SendKeys "{Home}+{end}"
Else
MsgBox "多次错误登陆,再见!", , "系统登陆"
End
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -