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

📄 frmlogin.frm

📁 vb6.0作的图书借阅管理系统,用户名admin 密码admin
💻 FRM
字号:
VERSION 5.00
Object = "{CAE5D8A3-35CD-461C-A280-B343F9487618}#1.0#0"; "VsMenu61.ocx"
Begin VB.Form frmLogin 
   BorderStyle     =   4  'Fixed ToolWindow
   Caption         =   "登陆"
   ClientHeight    =   1395
   ClientLeft      =   45
   ClientTop       =   285
   ClientWidth     =   4110
   ControlBox      =   0   'False
   Icon            =   "frmLogin.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   1395
   ScaleWidth      =   4110
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin VB.Timer Timer1 
      Left            =   0
      Top             =   960
   End
   Begin VBVsNetMenu.VsNetBut btnCancle 
      Height          =   345
      Left            =   3000
      TabIndex        =   5
      Top             =   960
      Width           =   900
      _ExtentX        =   1588
      _ExtentY        =   609
      DrawStyle       =   3
      ActionAsMenuEdgeColor=   -2147483632
      ShowEdgeOnNoFocus=   -1  'True
      ShowGradient    =   0   'False
      CaptionAreaPercent=   100
      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
   End
   Begin VBVsNetMenu.VsNetBut btnOK 
      Default         =   -1  'True
      Height          =   345
      Left            =   1920
      TabIndex        =   4
      Top             =   960
      Width           =   900
      _ExtentX        =   1588
      _ExtentY        =   609
      DrawStyle       =   3
      ActionAsMenuEdgeColor=   -2147483632
      ShowEdgeOnNoFocus=   -1  'True
      ShowGradient    =   0   'False
      CaptionAreaPercent=   100
      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
      Enabled         =   0   'False
   End
   Begin VB.TextBox txtPwd 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   315
      IMEMode         =   3  'DISABLE
      Left            =   1080
      PasswordChar    =   "*"
      TabIndex        =   3
      Top             =   480
      Width           =   2895
   End
   Begin VB.TextBox txtUser 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   315
      Left            =   1080
      TabIndex        =   2
      Top             =   120
      Width           =   2895
   End
   Begin VB.Label lblPwd 
      AutoSize        =   -1  'True
      Caption         =   "  密码:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Left            =   240
      TabIndex        =   1
      Top             =   585
      Width           =   735
   End
   Begin VB.Label lblUser 
      AutoSize        =   -1  'True
      Caption         =   "用户名:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Left            =   240
      TabIndex        =   0
      Top             =   225
      Width           =   735
   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 Times As Integer
Dim ADOLogin As New ADODB.Recordset

Private Sub btnCancle_Click()
    End
End Sub

Private Sub btnOK_Click()
    If Login(Trim(txtUser.Text), Trim(txtPwd.Text)) = True Then
        Unload Me
    Else
        If MsgBox("输入的用户名称或者口令非法,请重新输入!", vbInformation + vbYesNo, "非法的操作员口令") = vbYes Then
            txtUser.Text = ""
            txtPwd.Text = ""
            txtUser.SetFocus
            Times = Times + 1
        Else
            End
        End If
    End If
End Sub

Private Sub Form_Load()
    ADOLogin.Open "Login", ADOCon, adOpenDynamic, adLockOptimistic, -1
End Sub

Private Sub Form_Unload(Cancel As Integer)
    ADOLogin.Close
End Sub

Private Sub Timer1_Timer()
    If Times = 3 Then End
End Sub

Private Sub txtUser_Change()
    btnOK.Enabled = True
End Sub

Private Sub txtPwd_Change()
    btnOK.Enabled = True
End Sub

Private Function Login(ByVal strUSER As String, ByVal strPWD As String) As Boolean
    If strUSER = "Administrator" Then
        If strPWD = "Administrator" Then
            User = "Administrator"
            UserPermission = "Administrator"
            Login = True
            Exit Function
        Else
            Login = False
        End If
    Else
        ADOLogin.MoveFirst
        Do Until ADOLogin.EOF
            If strUSER = ADOLogin.Fields(0).Value And strPWD = ADOLogin.Fields(2).Value Then
                User = ADOLogin.Fields(0).Value
                UserPermission = ADOLogin.Fields(1).Value
                Login = True
                Exit Function
            Else
                ADOLogin.MoveNext
            End If
        Loop
        Login = False
    End If
End Function

⌨️ 快捷键说明

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