📄 frmlogin.frm
字号:
VERSION 5.00
Begin VB.Form frmLogin
BorderStyle = 3 'Fixed Dialog
Caption = "Login"
ClientHeight = 3330
ClientLeft = 30
ClientTop = 330
ClientWidth = 5175
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3330
ScaleWidth = 5175
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Tag = "Login"
Begin VB.CommandButton cmdCancel
Cancel = -1 'True
Caption = "Cancel"
Height = 360
Left = 2760
TabIndex = 5
Tag = "Cancel"
Top = 1944
Width = 1140
End
Begin VB.CommandButton cmdOK
Caption = "OK"
Default = -1 'True
Height = 360
Left = 1080
TabIndex = 4
Tag = "OK"
Top = 1944
Width = 1140
End
Begin VB.TextBox txtPassword
Height = 288
IMEMode = 3 'DISABLE
Left = 1548
PasswordChar = "*"
TabIndex = 1
Top = 1452
Width = 2325
End
Begin VB.TextBox txtUserName
Height = 288
Left = 1548
TabIndex = 3
Top = 1056
Width = 2325
End
Begin VB.Label Label4
Caption = "版权提供:MicroSoftware Corp@2006 lydia"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 255
Left = 120
TabIndex = 7
Top = 2760
Width = 4935
End
Begin VB.Label Label1
Caption = "企业人事信息管理系统"
BeginProperty Font
Name = "华文新魏"
Size = 21.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 375
Left = 120
TabIndex = 6
Top = 360
Width = 4575
End
Begin VB.Label lblLabels
Caption = "密码"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Index = 1
Left = 348
TabIndex = 0
Tag = "&Password:"
Top = 1464
Width = 1080
End
Begin VB.Label lblLabels
Caption = "用户名:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Index = 0
Left = 348
TabIndex = 2
Tag = "&User Name:"
Top = 1080
Width = 1080
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpbuffer As String, nSize As Long) As Long
Public OK As Boolean
Option Explicit
Public micount As Integer
Private Sub Form_Load()
Dim sBuffer As String
Dim lSize As Long
sBuffer = Space$(255)
lSize = Len(sBuffer)
Call GetUserName(sBuffer, lSize)
If lSize > 0 Then
txtUserName.Text = ""
Else
txtUserName.Text = vbNullString
End If
OK = False
micount = 0
End Sub
Private Sub cmdCancel_Click()
OK = False
Me.Hide
End Sub
Private Sub cmdOK_Click()
'用来存放SQL语句
Dim txtSQL As String
'用来存放记录集对象
Dim mrc As ADODB.Recordset
'用来存放返回信息
Dim MsgText As String
UserName = ""
'判断输入用户名是否为空
If Trim(txtUserName.Text = "") Then
MsgBox "没有这个用户,请重新输入用户名!", vbOKOnly + vbExclamation, "警告"
txtUserName.SetFocus
Else
'查询指定用户名的记录
txtSQL = "select *from user_info1 where user_ID='" & txtUserName.Text & "'"
'执行查询语句
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = True Then
MsgBox "没有这个用户,请重新输入用户!", vbOKOnly + vbExclamation, "警告"
txtUserName.SetFocus
Else
'判断输入密码是否正确
If Trim(mrc.Fields(1)) = Trim(txtPassword.Text) Then
OK = True
mrc.Close
Me.Hide
UserName = Trim(txtUserName.Text)
Else
MsgBox "输入密码不正确,请重新输入!", vbOKOnly + vbExclamation, "警告"
txtPassword.SetFocus
txtPassword.Text = ""
End If
End If
End If
'记载输入密码次数
micount = micount + 1
If micount = 3 Then
Me.Hide
End If
Exit Sub
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -