📄 frmlogin.frm
字号:
VERSION 5.00
Object = "{0BA686C6-F7D3-101A-993E-0000C0EF6F5E}#1.0#0"; "THREED32.OCX"
Begin VB.Form frmLogin
BackColor = &H80000013&
BorderStyle = 3 'Fixed Dialog
ClientHeight = 1575
ClientLeft = 2835
ClientTop = 3195
ClientWidth = 4005
ControlBox = 0 'False
Icon = "frmLogin.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 930.561
ScaleMode = 0 'User
ScaleWidth = 3760.478
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame1
Height = 1935
Left = -120
TabIndex = 0
Top = -120
Width = 4455
Begin Threed.SSCommand cmdOK
Height = 360
Left = 1080
TabIndex = 5
Top = 1200
Width = 1140
_Version = 65536
_ExtentX = 2011
_ExtentY = 635
_StockProps = 78
Caption = "&A.确 定"
Font3D = 1
End
Begin VB.TextBox txtPassword
Appearance = 0 'Flat
Height = 325
IMEMode = 3 'DISABLE
Left = 1065
PasswordChar = "*"
TabIndex = 2
Top = 765
Width = 2685
End
Begin VB.TextBox txtUser
Appearance = 0 'Flat
Height = 325
Left = 1080
TabIndex = 1
Top = 360
Width = 2685
End
Begin Threed.SSCommand cmdCancel
Height = 360
Left = 2520
TabIndex = 6
Top = 1200
Width = 1140
_Version = 65536
_ExtentX = 2011
_ExtentY = 635
_StockProps = 78
Caption = "取 消(&Q)"
Font3D = 1
End
Begin VB.Label lblLabels
BackStyle = 0 'Transparent
Caption = "密 码(&P)"
Height = 270
Index = 1
Left = 240
TabIndex = 4
Top = 792
Width = 1080
End
Begin VB.Label lblLabels
BackStyle = 0 'Transparent
Caption = "用 户(&U)"
Height = 270
Index = 0
Left = 240
TabIndex = 3
Top = 387
Width = 1080
End
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim WithEvents rs As Recordset
Attribute rs.VB_VarHelpID = -1
Private Sub cmdCancel_Click()
'设置全局变量为 false
'不提示失败的登录
End
End Sub
Private Sub cmdOK_Click()
Dim Sql As String
Sql = "select * from t_user where usercode='" & Trim$(Me.txtUser) & "' and password='" & Trim$(Me.txtPassword) & "'"
Set rs = ConnWZ.Execute(Sql)
If Not rs.EOF Then
With UserInfo
.UserCode = Trim$(rs!UserCode)
.UserName = Trim$(rs!UserName)
.Pwd = Trim$(rs!Password)
.QX = rs!QX
End With
'Call LogInfo(True)
Me.Hide
RSGL.Show
rs.Close
Exit Sub
Else '
MsgBox "用户名或口令输入错误!", vbExclamation, "系统提示"
txtUser.Text = ""
txtUser.SetFocus
txtPassword.Text = ""
rs.Close
Exit Sub
End If
Err:
MsgBox "用户名、口令或数据库连接串输入错误!数据库连接失败!", vbExclamation, "系统提醒你:"
End Sub
Private Sub Form_Load()
Dim Sql As String
Me.txtPassword = ""
With Me.txtUser
.Text = ""
.SelStart = 0
.SelLength = Len(.Text)
End With
Sql = "select * from t_user"
Set rs = ConnWZ.Execute(Sql)
If rs.EOF Then
Sql = "insert t_user(usercode,username,password,qx) values('Admin','管理员','123456',0)"
ConnWZ.Execute (Sql)
End If
rs.Close
End Sub
Private Sub Form_Unload(Cancel As Integer)
End
End Sub
Private Sub txtpassword_keypress(KeyAscii As Integer)
If KeyAscii = 13 Then
Call cmdOK_Click
End If
End Sub
Private Sub txtUser_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtPassword.SetFocus
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -