📄 frmlogin.frm
字号:
VERSION 5.00
Begin VB.Form frmlogin
BorderStyle = 3 'Fixed Dialog
Caption = "系统登陆"
ClientHeight = 3840
ClientLeft = 2445
ClientTop = 1755
ClientWidth = 5610
Icon = "frmlogin.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3840
ScaleWidth = 5610
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame1
Height = 2655
Left = 120
TabIndex = 4
Top = 960
Width = 5415
Begin VB.TextBox tbusername
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 270
Left = 1800
TabIndex = 0
Text = "admin"
Top = 480
Width = 2655
End
Begin VB.TextBox tbpwd
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 270
IMEMode = 3 'DISABLE
Left = 1800
PasswordChar = "*"
TabIndex = 1
Text = "admin"
Top = 1080
Width = 2655
End
Begin VB.CommandButton cmdt
Caption = "确定"
Default = -1 'True
Height = 495
Left = 1800
TabIndex = 2
Top = 1680
Width = 1215
End
Begin VB.CommandButton cmdf
Caption = "取消"
Height = 495
Left = 3240
TabIndex = 3
Top = 1680
Width = 1215
End
Begin VB.Image Imagelogin
Height = 720
Left = 480
Picture = "frmlogin.frx":08CA
Top = 1440
Width = 720
End
Begin VB.Label labuser
Caption = "用户名:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 0
Left = 600
TabIndex = 6
Top = 480
Width = 855
End
Begin VB.Label labuser
Caption = "密码:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 1
Left = 600
TabIndex = 5
Top = 1080
Width = 855
End
End
Begin VB.Label Label1
Caption = "操作员登陆"
BeginProperty Font
Name = "宋体"
Size = 21.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 435
Left = 1560
TabIndex = 7
Top = 240
Width = 2175
End
Begin VB.Image ImageHead
Height = 900
Left = 0
Top = 0
Width = 5700
End
End
Attribute VB_Name = "frmlogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim errortime As Integer '用户输入的错误次数
Option Explicit
Private Sub cmdf_Click()
'tbusername = ""
'tbpwd = ""
Unload Me
End Sub
Private Sub cmdt_Click()
Dim rs As ADODB.Recordset
Dim sql As String
Dim UserName As String
Dim password As String
UserName = Trim(tbusername.Text)
If UserName = "" Then
MsgBox "用户名不能为空!", vbInformation, "系统登陆提示"
Exit Sub
End If
password = tbpwd.Text
sql = "select * from 系统表 where 用户名='" & UserName & "'"
Set rs = ExeSQL(sql)
If rs.EOF = True Then
If errortime > 2 Then
MsgBox "连续三次输入错误,系统自动退出!如果有何疑问请与系统管理员联系.", vbCritical, "系统提示"
Unload Me
Else
MsgBox "没有此用户,请重新输入用户名!", vbExclamation
errortime = errortime + 1
tbusername.Text = ""
tbusername.SetFocus
End If
Else
If password = rs!密码 Then
Load frmmain
frmmain.Show
IsLogin = True
LoginUserName = UserName
Me.Hide
Unload Me
Else
MsgBox "密码输入错误,请重试!", vbInformation, "系统登陆提示"
errortime = errortime + 1
tbpwd.Text = ""
tbpwd.SetFocus
End If
End If
rs.Close
Set rs = Nothing
End Sub
Private Sub Form_Load()
errortime = 1
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set frmlogin = Nothing
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -