📄 frmlogin.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frmLogin
BackColor = &H00C0C0C0&
BorderStyle = 1 'Fixed Single
Caption = "系统登录"
ClientHeight = 3390
ClientLeft = 45
ClientTop = 330
ClientWidth = 4590
ControlBox = 0 'False
FillColor = &H00404040&
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3390
ScaleWidth = 4590
StartUpPosition = 2 '屏幕中心
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 0
Top = 0
Visible = 0 'False
Width = 2040
_ExtentX = 3598
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "权限设置"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.CommandButton cmdCancel
Cancel = -1 'True
Caption = "取消"
Height = 375
Left = 2760
TabIndex = 8
Top = 2880
Width = 855
End
Begin VB.CommandButton cmdOk
Caption = "确定"
Height = 375
Left = 1080
TabIndex = 7
Top = 2880
Width = 855
End
Begin VB.Frame Frame1
BackColor = &H00C0C0C0&
Caption = "登录"
ForeColor = &H00FF0000&
Height = 2250
Left = 240
TabIndex = 0
Top = 495
Width = 4095
Begin VB.PictureBox Picture2
Appearance = 0 'Flat
BackColor = &H00C0C0C0&
BorderStyle = 0 'None
ForeColor = &H80000008&
Height = 495
Left = 240
Picture = "frmLogin.frx":0000
ScaleHeight = 495
ScaleWidth = 615
TabIndex = 10
Top = 1080
Width = 615
End
Begin VB.PictureBox Picture1
Appearance = 0 'Flat
BackColor = &H00C0C0C0&
BorderStyle = 0 'None
ForeColor = &H80000008&
Height = 495
Left = 240
Picture = "frmLogin.frx":122E
ScaleHeight = 495
ScaleWidth = 495
TabIndex = 9
Top = 360
Width = 495
End
Begin VB.TextBox txtPassword
BackColor = &H00FFFFFF&
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 375
IMEMode = 3 'DISABLE
Left = 2040
PasswordChar = "*"
TabIndex = 2
Top = 1150
Width = 1575
End
Begin VB.TextBox txtName
BackColor = &H00FFFFFF&
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 375
Left = 2040
TabIndex = 1
Top = 360
Width = 1575
End
Begin VB.Label Label4
BackColor = &H00C0C0C0&
Caption = $"frmLogin.frx":2150
ForeColor = &H000000FF&
Height = 390
Left = 595
TabIndex = 6
Top = 1815
Width = 3165
End
Begin VB.Label Label1
BackColor = &H00C0C0C0&
Caption = "登录名"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 255
Left = 1080
TabIndex = 4
Top = 480
Width = 735
End
Begin VB.Label Label2
BackColor = &H00C0C0C0&
Caption = "密 码"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 255
Left = 1080
TabIndex = 3
Top = 1245
Width = 735
End
End
Begin VB.Label Label3
BackColor = &H00C0C0C0&
Caption = "系统登录"
BeginProperty Font
Name = "宋体"
Size = 18
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 390
Left = 1635
TabIndex = 5
Top = 150
Width = 1440
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 iCount As Integer
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
With Adodc1.Recordset
If iCount < 3 Then
.MoveFirst
Do While Not .EOF
If Trim(txtName.Text) = !登录名 Then
If Trim(txtPassword.Text) = !密码 Then
MsgBox "欢迎您使用本系统!", vbInformation, "欢迎"
LoginName = Trim(txtName)
Unload Me
frmStart.Show
frmStart.Refresh
Set fMainForm = New frmMain
Load fMainForm
Unload frmStart
fMainForm.Show
Exit Sub
Else
MsgBox "密码不正确,请重输!"
txtPassword.Text = ""
txtPassword.SetFocus
iCount = iCount + 1
Exit Sub
End If
End If
.MoveNext
Loop
MsgBox "用户名和密码不正确,请重输!"
txtPassword.Text = ""
txtName.SetFocus
txtName.SelStart = 0
txtName.SelLength = Len(txtName.Text)
iCount = iCount + 1
Exit Sub
Else
MsgBox "用户名和密码三次输入不正确," & vbCrLf & "系统将自行退出!"
Unload Me
End If
End With
End Sub
Private Sub Form_Load()
Dim ConnStr As String
iCount = 0
txtName = GetSetting(appname:="传销工资管理", Section:="系统登录", Key:="用户名", Default:="系统管理员")
ConnStr = "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=c:\system\database\system.mdb"
Adodc1.ConnectionString = ConnStr
Adodc1.CommandType = adCmdTable
Adodc1.RecordSource = "权限设置"
Adodc1.Refresh
End Sub
Private Sub txtName_Change()
SaveSetting appname:="传销工资管理", Section:="系统登录", Key:="用户名", setting:="系统管理员"
SaveSetting "传销工资管理", "系统登录", "用户名", txtName
End Sub
Private Sub txtName_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtPassword.SetFocus
End If
End Sub
Private Sub txtPassword_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
cmdOk.SetFocus
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -