📄 登录窗口.frm
字号:
VERSION 5.00
Begin VB.Form login
Caption = "登录窗口"
ClientHeight = 4305
ClientLeft = 4740
ClientTop = 4185
ClientWidth = 6105
LinkTopic = "Form1"
ScaleHeight = 4305
ScaleWidth = 6105
Begin VB.TextBox Text2
Height = 375
IMEMode = 3 'DISABLE
Left = 2280
PasswordChar = "*"
TabIndex = 5
Top = 1320
Width = 1695
End
Begin VB.TextBox Text1
Height = 375
Left = 2280
TabIndex = 4
Top = 360
Width = 1695
End
Begin VB.CommandButton Command2
Caption = "取消"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 3480
TabIndex = 1
Top = 2880
Width = 975
End
Begin VB.CommandButton Command1
Caption = "登录"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1080
TabIndex = 0
Top = 2880
Width = 975
End
Begin VB.Label Label2
Caption = "密码"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1200
TabIndex = 3
Top = 1440
Width = 1215
End
Begin VB.Label Label1
Caption = "帐号"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1200
TabIndex = 2
Top = 480
Width = 1095
End
End
Attribute VB_Name = "login"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
loginOK = False
ErrCount = 0
End Sub
Private Sub Command1_Click()
Dim txtmsg As String
UserName = Trim$(Text1.Text)
Password = Trim$(Text2.Text)
If UserName = "" Then
MsgBox "登陆帐号不能为空,请重新输入登陆帐号!", vbOKOnly + vbExclamation, "警告"
Text1.SetFocus
Exit Sub
End If
If Password = "" Then
MsgBox "登陆密码不能为空,请重新输入登陆帐号!", vbOKOnly + vbExclamation, "警告"
Text2.SetFocus
Exit Sub
End If
Dim rs As ADODB.Recordset
If ErrCount = 2 Then
MsgBox "登陆信息输入错误三次,系统将自动关闭!", vbOKOnly + vbExclamation, "警告"
Me.Hide
Unload login
mainform.Hide
Unload mainform
End
Else
txtSQL = "select * from muser where user_name='" & UserName & "'"
Set rs = ExecuteSQL(txtSQL, txtmsg)
If rs.EOF = True Then
MsgBox "没有这个登陆帐号,请重新输入登陆帐号!", vbOKOnly + vbExclamation, "警告"
ErrCount = ErrCount + 1
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
Exit Sub
Else
If Password <> rs("user_pwd") Then
MsgBox "登陆密码错误,请重新输入登陆密码!", vbOKOnly + vbExclamation, "警告"
ErrCount = ErrCount + 1
Text2.Text = ""
Text2.SetFocus
Exit Sub
Else
loginOK = True
mainform.StatusBar1.Panels(2).Text = UserName
mainform.dlxt.Enabled = False
mainform.tcdl.Enabled = True
mainform.xgma.Enabled = True
mainform.tjyh.Enabled = True
mainform.cmdpk.Enabled = True
mainform.cmdrk.Enabled = True
mainform.cmdck.Enabled = True
mainform.cmdcx.Enabled = True
mainform.cmdqt.Enabled = True
mainform.cmdwz.Enabled = True
MsgBox "用户登陆成功!", vbOKOnly + vbExclamation, "警告"
Me.Hide
Unload login
mainform.cmdwz.SetFocus
End If
End If
rs.Close
Set rs = Nothing
End If
End Sub
Private Sub Command2_Click()
login.Hide
Unload login
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -