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

📄 frmlogin.frm

📁 一个图书管理系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmLogin 
   BackColor       =   &H80000003&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Login Screen"
   ClientHeight    =   2775
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4455
   ControlBox      =   0   'False
   Icon            =   "frmLogin.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2775
   ScaleWidth      =   4455
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  'Windows Default
   Begin VB.ComboBox dbUserId 
      Appearance      =   0  'Flat
      BackColor       =   &H00FFFFFF&
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   360
      Left            =   2280
      Sorted          =   -1  'True
      Style           =   2  'Dropdown List
      TabIndex        =   5
      ToolTipText     =   "Select User Name"
      Top             =   360
      Width           =   1695
   End
   Begin VB.CommandButton cmdCancel 
      BackColor       =   &H80000004&
      Cancel          =   -1  'True
      Caption         =   "&Cancel"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   2280
      Style           =   1  'Graphical
      TabIndex        =   4
      Top             =   1800
      Width           =   1455
   End
   Begin VB.CommandButton cmdLogin 
      BackColor       =   &H8000000B&
      Caption         =   "&Login"
      Default         =   -1  'True
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   600
      Style           =   1  'Graphical
      TabIndex        =   3
      Top             =   1800
      Width           =   1455
   End
   Begin VB.TextBox txtPasswd 
      BackColor       =   &H00FFFFFF&
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00000000&
      Height          =   375
      IMEMode         =   3  'DISABLE
      Left            =   2280
      PasswordChar    =   "*"
      TabIndex        =   2
      ToolTipText     =   "Password is Same as User Name for Demo Version"
      Top             =   1080
      Width           =   1695
   End
   Begin VB.Label lblPasswd 
      BackStyle       =   0  'Transparent
      Caption         =   "Password"
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   480
      TabIndex        =   1
      Top             =   1080
      Width           =   1575
   End
   Begin VB.Label lblUserId 
      BackStyle       =   0  'Transparent
      Caption         =   "User Name"
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   480
      TabIndex        =   0
      Top             =   360
      Width           =   1575
   End
   Begin VB.Shape Shape1 
      BackColor       =   &H00E0E0E0&
      BackStyle       =   1  'Opaque
      FillColor       =   &H00C0E0FF&
      Height          =   2535
      Left            =   120
      Shape           =   4  'Rounded Rectangle
      Top             =   120
      Width           =   4215
   End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'=====================================================
'*****************************************************
'* Programmed by : Vivek Patel                       *
'* Contact :  Email   => vivek_patel9@rediffmail.com *
'*            Website => www.VIVEKPATEL.cjb.net      *
'* Description :  Login Screen Code                  *
'* Vote For Me : If you really enjoy this utility or *
'                 helped by any of the functionality *
'                 than plz. reward us by your VOTE.  *
'*****************************************************
'=====================================================

Option Explicit

Dim Srchflag As Boolean
      



Private Sub Form_Load()
On Error Resume Next
    frmSYSTRAYICON.mnuAboutMe.Enabled = False
    frmSYSTRAYICON.mnuExit.Enabled = False
    frmSYSTRAYICON.mnuLogOff.Enabled = False
    
    Move (Screen.Width - Width) \ 2, (Screen.Height - Height) \ 2
    txtPasswd = ""
    
    Dim i As Integer
    
    For i = 0 To rsUser.RecordCount
        dbUserId.AddItem rsUser(0)
        rsUser.MoveNext
        If rsUser.EOF = True Then
             rsUser.MoveLast
             dbUserId.ListIndex = 0 'For displaying by default admin
             Exit Sub
        End If
    Next i
        
    Srchflag = False 'Initially Search is not found

End Sub
      
      
'Check for Valid Password Corresponding to user Name
Private Sub cmdLogin_Click()
On Error Resume Next
    rsUser.Close  'After the user_id are loaded into dbUserId close the
                  'Recordset for further usage
    rsUser.Open "Select passwd from user where user_id = '" & dbUserId.Text & "'", cn, adOpenDynamic, adLockOptimistic
    
    If rsUser.EOF <> True Then 'If Search is found
         If rsUser(0) = txtPasswd Then
             sUserName = UCase(dbUserId.Text)
             frmMain.status.Panels(1).Text = "User Name : " & sUserName
             DoEvents
             'Check If user is Admin
             'Checking : To allow Settings Menu Available only to Admin
             If sUserName <> "ADMIN" Then
                frmMain.mnuSetting.Enabled = False
             Else
                frmMain.mnuSetting.Enabled = True
             End If
             Unload Me
             frmSYSTRAYICON.mnuAboutMe.Enabled = True
             frmSYSTRAYICON.mnuExit.Enabled = True
             frmSYSTRAYICON.mnuLogOff.Enabled = True
             DoEvents
             frmMain.Show
             DoEvents
        '     Srchflag = True
             Exit Sub
             rsUser.Close
         Else
             MsgBox "Invalid Password!!!" & vbCrLf & "Note : Password is same as Username", vbInformation, "Enjoy Freeware"
             txtPasswd.Text = ""
             txtPasswd.SetFocus
             Exit Sub
         End If
    End If
    
    'If Srchflag = False Then 'Display msg when search not found
    '     MsgBox "Invalid Password" & vbCrLf & "No Access!!!", vbCritical, "Invalid User"
    '     End
    'End If
End Sub

'Simply Quit the Loaded Stuff!!!
Private Sub cmdCancel_Click()
On Error Resume Next
    End
End Sub


'=====================================================
'*****************************************************
'* Vote For Me : If you really enjoy this utility or *
'                 helped by any of the functionality *
'                 than plz. reward us by your VOTE.  *
'*****************************************************
'=====================================================

⌨️ 快捷键说明

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