📄 frmlogin.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "msadodc.ocx"
Begin VB.Form frmLogin
Caption = "职工工资管理系统 - 毕业设计作品"
ClientHeight = 3345
ClientLeft = 60
ClientTop = 345
ClientWidth = 5625
LinkTopic = "Form1"
ScaleHeight = 3345
ScaleWidth = 5625
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame1
Height = 1215
Left = 600
TabIndex = 2
Top = 960
Width = 4695
Begin VB.TextBox PassWord
DataSource = "Adodc1"
Height = 288
IMEMode = 3 'DISABLE
Left = 1680
PasswordChar = "*"
TabIndex = 7
Text = "admin"
Top = 720
Width = 2064
End
Begin VB.TextBox UserName
DataSource = "Adodc1"
Height = 288
Left = 1680
TabIndex = 6
Text = "admin"
Top = 360
Width = 2064
End
Begin VB.Label lblLabels
Caption = "密 码:"
BeginProperty Font
Name = "华文新魏"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 0
Left = 720
TabIndex = 4
Tag = "&Password:"
Top = 720
Width = 1080
End
Begin VB.Label lblLabels
Caption = "用户名:"
BeginProperty Font
Name = "华文新魏"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 2
Left = 600
TabIndex = 3
Tag = "&User Name:"
Top = 360
Width = 1080
End
End
Begin VB.CommandButton cmdCancel
Cancel = -1 'True
Caption = "取 消"
Height = 480
Index = 1
Left = 3480
TabIndex = 1
Tag = "Cancel"
Top = 2640
Width = 1380
End
Begin VB.CommandButton cmdOK
Caption = "确 定"
Default = -1 'True
Height = 480
Index = 1
Left = 720
TabIndex = 0
Tag = "OK"
Top = 2640
Width = 1260
End
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 1200
Top = 2040
Visible = 0 'False
Width = 3375
_ExtentX = 5953
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=database\企业工资管理系统.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=database\企业工资管理系统.mdb;Persist Security Info=False"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "用户信息表"
Caption = "Adodc1"
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.Line Line2
X1 = 0
X2 = 6120
Y1 = 2520
Y2 = 2520
End
Begin VB.Line Line1
BorderColor = &H80000009&
BorderWidth = 3
X1 = 0
X2 = 6120
Y1 = 2520
Y2 = 2520
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 = &H00C00000&
Height = 495
Left = 720
TabIndex = 5
Top = 240
Width = 4455
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdCancel_Click(Index As Integer)
Unload Me
Exit Sub
End Sub
Private Sub cmdOK_Click(Index As Integer)
'On Error GoTo errorhandle
Dim finduser As Boolean
finduser = False
Adodc1.Recordset.MoveFirst '将记录指针移动到首记录
If Trim(UserName.Text = "") Then
MsgBox "请输入用户名称!", vbOKOnly + vbExclamation, "警告"
UserName.SetFocus
Exit Sub
Else
Do While Not Adodc1.Recordset.EOF '判断数据表是否已经读完,即遍历整张表
If Adodc1.Recordset.Fields("用户名称") = Trim(UserName.Text) Then 'field就是某个字段
finduser = True
If Adodc1.Recordset.Fields("用户密码") = Trim(PassWord.Text) Then
Me.Hide
strUserName = Trim(UserName.Text) '保存用户名称
frmMain.Show
Unload Me
Else
MsgBox "密码不正确,请重新输入!", vbOKOnly + vbExclamation, "警告"
PassWord.SetFocus
PassWord.Text = ""
End If
End If
Adodc1.Recordset.MoveNext '记录往下移动一条
Loop
If finduser = False Then
MsgBox "没有这个用户,请重新输入!", vbOKOnly + vbExclamation, "警告"
UserName.SetFocus
UserName.Text = ""
End If
End If
Exit Sub
errorhandle:
MsgBox "您的操作有误!", vbOKOnly + vbExclamation, "错误"
End Sub
Private Sub Form_Load()
UserName.Text = ""
PassWord.Text = ""
'Adodc1.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=database\企业工资管理系统.mdb;"
End Sub
Private Sub PassWord_KeyPress(KeyAscii As Integer)
Dim finduser As Boolean
finduser = False
Adodc1.Recordset.MoveFirst '将记录指针移动到首记录
If KeyAscii = 13 Then
If Trim(UserName.Text = "") Then
MsgBox "请输入用户名称!", vbOKOnly + vbExclamation, "警告"
UserName.SetFocus
Exit Sub
Else
Do While Not Adodc1.Recordset.EOF '判断数据表是否已经读完,即遍历整张表
If Adodc1.Recordset.Fields("用户名称") = Trim(UserName.Text) Then 'field就是某个字段
finduser = True
If Adodc1.Recordset.Fields("用户密码") = Trim(PassWord.Text) Then
Me.Hide
strUserName = Trim(UserName.Text) '保存用户名称
frmMain.Show
Unload Me
Else
MsgBox "密码不正确,请重新输入!", vbOKOnly + vbExclamation, "警告"
PassWord.SetFocus
PassWord.Text = ""
End If
End If
Adodc1.Recordset.MoveNext '记录往下移动一条
Loop
If finduser = False Then
MsgBox "没有这个用户,请重新输入!", vbOKOnly + vbExclamation, "警告"
UserName.SetFocus
UserName.Text = ""
End If
End If
Exit Sub
errorhandle:
MsgBox "您的操作有误!", vbOKOnly + vbExclamation, "错误"
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -