📄 frmlogin.frm
字号:
VERSION 5.00
Begin VB.Form frmLogin
BackColor = &H00FFC0FF&
Caption = "Login"
ClientHeight = 3600
ClientLeft = 60
ClientTop = 345
ClientWidth = 6750
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Login"
ScaleHeight = 3600
ScaleWidth = 6750
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton cmdCancel
Caption = "Cancel"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 4800
TabIndex = 6
Top = 2400
Width = 1215
End
Begin VB.CommandButton cmdOK
Caption = "ok"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 3120
Style = 1 'Graphical
TabIndex = 5
Top = 2400
Width = 1215
End
Begin VB.TextBox txtPassword
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
IMEMode = 3 'DISABLE
Left = 3840
PasswordChar = "*"
TabIndex = 4
Top = 1800
Width = 2535
End
Begin VB.TextBox txtUserName
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3840
TabIndex = 2
Top = 1080
Width = 2535
End
Begin VB.Label Label5
BackColor = &H00008080&
Caption = " 用户名:admin 密码:admin"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C0FFFF&
Height = 375
Left = 240
TabIndex = 7
Top = 3120
Visible = 0 'False
Width = 6375
End
Begin VB.Label Label3
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 = 375
Left = 2760
TabIndex = 3
Top = 1800
Width = 975
End
Begin VB.Label Label2
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 = 375
Left = 2760
TabIndex = 1
Top = 1080
Width = 975
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = " 宾馆管理信息系统"
BeginProperty Font
Name = "华文行楷"
Size = 26.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 615
Left = 2040
TabIndex = 0
Top = 120
Width = 4575
End
Begin VB.Image Image1
Height = 3405
Left = 120
Picture = "frmLogin.frx":0000
Top = 120
Width = 2130
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
Public loginsucceeded As Boolean
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 = Left$(sBuffer, lSize)
' Else
' txtUserName.Text = vbNullString
'End If
'txtUserName.Text = "admin"
'txtPassword.Text = "admin"
'loginsucceeded = False
End Sub
Private Sub cmdCancel_Click()
End
End Sub
Private Sub cmdOK_Click()
Dim strUserID$, strPassword$, strSQL$, MsgText$
Dim mrc As ADODB.Recordset
Static Count As Byte
strUserID = Replace(Trim(txtUserName.Text), "'", "")
strPassword = Replace(Trim(txtPassword.Text), "'", "")
If strUserID = "" Then
MsgBox "用户名不能为空", , "登陆错误"
txtUserName.SetFocus
Exit Sub
ElseIf strPassword = "" Then
MsgBox "密码不能为空", , "登陆错误"
txtPassword.SetFocus
Exit Sub
End If
strSQL = "select * from user_info where user_ID='" & strUserID & "'"
strSQL = strSQL & " and user_PWD='" & strPassword & "';"
Set mrc = ExecuteSQL(strSQL, MsgText)
If mrc.EOF Then
Count = Count + 1
MsgBox "用户名不存在或密码错!", , "登陆失败"
txtUserName.Text = ""
txtPassword.Text = ""
txtUserName.SetFocus
Else
loginsucceedd = True
user_ID = strUserID
user_PWD = mrc("userid").Value
Me.Hide
End If
If Count >= 3 Then
MsgBox "超过次数", , "登陆失败"
End
End If
'ToDo: create test for correct password
'check for correct password
'If txtPassword.Text = "" Then
' OK = True
' Me.Hide
' FrmMain.Show
' Else
' MsgBox "Invalid Password, try again!", , "Login"
' txtPassword.SetFocus
' txtPassword.SelStart = 0
' txtPassword.SelLength = Len(txtPassword.Text)
'End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -