⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frm_login.frm

📁 HRMS是一个人力资源管理系统,非常好用,功能非常强大,希望大家的支持
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frm_Login 
   BackColor       =   &H8000000B&
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "欢迎使用人力资源管理系统"
   ClientHeight    =   3045
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   5940
   Icon            =   "frm_Login.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3045
   ScaleWidth      =   5940
   ShowInTaskbar   =   0   'False
   StartUpPosition =   1  '所有者中心
   Begin VB.Frame Frame2 
      Height          =   930
      Left            =   60
      TabIndex        =   1
      Top             =   2055
      Width           =   5835
      Begin VB.Label Label3 
         Caption         =   "    系统超级用户mr的初始密码为""mrsoft"",请进入系统后更改此密码。"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   435
         Left            =   240
         TabIndex        =   8
         Top             =   300
         Width           =   5445
      End
   End
   Begin VB.Frame Frame1 
      Height          =   2040
      Left            =   60
      TabIndex        =   0
      Top             =   0
      Width           =   5835
      Begin VB.CommandButton cmdCancel 
         Cancel          =   -1  'True
         Caption         =   "放弃 (&C)"
         Height          =   390
         Left            =   2955
         TabIndex        =   5
         Top             =   1440
         Width           =   1890
      End
      Begin VB.CommandButton cmdOK 
         Caption         =   "确定 (&O)"
         Height          =   390
         Left            =   975
         TabIndex        =   4
         Top             =   1440
         Width           =   1890
      End
      Begin VB.TextBox txtPassword 
         Height          =   345
         IMEMode         =   3  'DISABLE
         Left            =   1725
         PasswordChar    =   "*"
         TabIndex        =   3
         Top             =   795
         Width           =   3480
      End
      Begin VB.TextBox txtUserName 
         Height          =   345
         Left            =   1725
         TabIndex        =   2
         Top             =   405
         Width           =   3480
      End
      Begin VB.Label Label2 
         Caption         =   "密码(&P):"
         Height          =   270
         Left            =   540
         TabIndex        =   7
         Top             =   870
         Width           =   1080
      End
      Begin VB.Label Label1 
         Caption         =   "用户名称(&U):"
         Height          =   270
         Left            =   540
         TabIndex        =   6
         Top             =   450
         Width           =   1140
      End
   End
End
Attribute VB_Name = "frm_Login"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Const MaxTimes As Integer = 3
'Private Sub Form_Load()
'  Dim cn As New ADODB.Connection
'  cn.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=master"
'  On Error GoTo dataErr
'dataErr:
'  If Trim(Err.Description) <> "数据库 'db_sell' 已存在。" Then
'    cn.Execute ("sp_attach_db @dbname ='db_sell', @filename1 = N" & "'" & App.Path & "\db_sell_Data.MDF', @filename2 = N" & "'" & App.Path & "\db_sell_Log.LDF'")
'  End If
'
'End Sub
Private Sub Form_Active()
  '窗体加载时,用户名文本框获得焦点
  txtUserName.SetFocus
End Sub
Private Sub txtPassword_GotFocus()
  txtPassword.BackColor = &HFFFF00
  txtPassword.SelStart = 0
  txtPassword.SelLength = Len(txtPassword.text)
End Sub
Private Sub txtPassword_LostFocus()
  txtPassword.BackColor = &H80000005
End Sub
Private Sub txtUserName_GotFocus()
  txtUserName.BackColor = &HFFFF00
  txtUserName.SelStart = 0
  txtUserName.SelLength = Len(txtUserName.text)
End Sub
Private Sub txtUserName_LostFocus()
  txtUserName.BackColor = &H80000005
End Sub
Private Sub txtUserName_KeyDown(KeyCode As Integer, Shift As Integer)
  '在用户名文本框处按回车键,密码文本框获得焦点
  If KeyCode = vbKeyReturn Then txtPassword.SetFocus
End Sub
Private Sub txtPassword_KeyDown(KeyCode As Integer, Shift As Integer)
  '在密码文本框处按回车键,确定按钮获得焦点
  If KeyCode = vbKeyReturn Then cmdOK.SetFocus
End Sub
Private Sub cmdOK_Click()
  Static intMyTimes As Integer
  Dim rs1 As New ADODB.Recordset
  Dim rs2 As New ADODB.Recordset
  rs1.Open "权限信息表", Cnn, adOpenKeyset, adLockOptimistic
  If rs1.RecordCount > 0 Then
    If txtUserName.text = "" Then
        MsgBox "请输入用户名!", , "提示窗口"
        txtUserName.SetFocus
        Exit Sub
    End If
    rs2.Open "权限信息表 where 操作员='" + txtUserName.text + "'", Cnn, adOpenStatic, , adCmdTable
    If rs2.RecordCount > 0 Then
      If txtPassword.text = "" Then
        MsgBox "请输入密码!", , "提示窗口"
        txtPassword.SetFocus
        Exit Sub
      End If
      If txtPassword = rs2.Fields("密码") Then
         czy = txtUserName
         Load frmMain
         frmMain.Show
         Unload Me
      Else
         If intMyTimes > MaxTimes Then
            MsgBox "您无权使用该软件!", , "提示窗口"
            End
         Else
           MsgBox "密码不正确,请重新输入!", , "提示窗口"
           intMyTimes = intMyTimes + 1
           txtPassword.SetFocus
         End If
      End If
    Else
      MsgBox "用户名不正确,请重新输入!", , "提示窗口"
      txtUserName.SetFocus
    End If
    rs2.Close
  Else
    MsgBox "初次登录本系统,请在进入系统后,立即设置操作员及其密码,以确保系统的安全!", , "提示窗口"
    Load frmMain
    frmMain.Show
    Unload Me
  End If
  rs1.Close
End Sub
Private Sub cmdCancel_Click()
  Unload Me
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -