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

📄 frmlogin.frm

📁 一个为公安系统接警中心控制软件,不错哦.
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmLogin 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "登录"
   ClientHeight    =   2235
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   2880
   Icon            =   "frmLogin.frx":0000
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2235
   ScaleWidth      =   2880
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin VB.Frame Frame1 
      Caption         =   "操作员"
      Height          =   1695
      Left            =   120
      TabIndex        =   5
      Top             =   0
      Width           =   2655
      Begin VB.TextBox txtId 
         Height          =   270
         Left            =   960
         TabIndex        =   0
         Top             =   300
         Width           =   1485
      End
      Begin VB.TextBox txtName 
         Height          =   270
         Left            =   960
         TabIndex        =   1
         Top             =   765
         Width           =   1485
      End
      Begin VB.TextBox txtPassword 
         Height          =   270
         IMEMode         =   3  'DISABLE
         Left            =   960
         PasswordChar    =   "*"
         TabIndex        =   2
         Top             =   1230
         Width           =   1485
      End
      Begin VB.Label lblLabels 
         AutoSize        =   -1  'True
         Caption         =   "编码"
         Height          =   180
         Index           =   2
         Left            =   240
         TabIndex        =   8
         Tag             =   "用户名(&U):"
         Top             =   315
         Width           =   360
      End
      Begin VB.Label lblLabels 
         AutoSize        =   -1  'True
         Caption         =   "姓名"
         Height          =   180
         Index           =   0
         Left            =   240
         TabIndex        =   7
         Tag             =   "用户名(&U):"
         Top             =   780
         Width           =   360
      End
      Begin VB.Label lblLabels 
         AutoSize        =   -1  'True
         Caption         =   "口令"
         Height          =   180
         Index           =   1
         Left            =   240
         TabIndex        =   6
         Tag             =   "密码(&P):"
         Top             =   1245
         Width           =   360
      End
   End
   Begin VB.CommandButton cmdCancel 
      Cancel          =   -1  'True
      Caption         =   "取消"
      Height          =   360
      Left            =   1680
      TabIndex        =   4
      Tag             =   "取消"
      Top             =   1800
      Width           =   1020
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "确定"
      Height          =   360
      Left            =   240
      TabIndex        =   3
      Tag             =   "确定"
      Top             =   1800
      Width           =   1020
   End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public OK As Boolean
Dim SystemRs As ADODB.Recordset
Dim OperatorRs As ADODB.Recordset

Private Sub cmdCancel_Click()
    OK = False
    Me.Hide
End Sub

Private Sub cmdOk_Click()
    Dim sName As String, sPassword As String
    
    sName = Trim(txtName.Text)
    sPassword = txtPassword.Text
    If sName = "" Then
        If sPassword = SystemRs![FManufacturerPass] Then
            m_gsOperator = sName
            m_gsOperatorPass = sPassword
            m_gbManufacturer = True
            m_gbSuperMan = False
            m_gbSystemMan = True
            
            OK = True
            Me.Hide
            Exit Sub
        Else
            MsgBox "请输入操作员姓名!", vbOKOnly + vbInformation, "提示:"
            txtName.SetFocus
            Exit Sub
        End If
    End If
    
    If sName = SystemRs![FManager] Then      '主管登陆
        If sPassword = SystemRs![FPassword] Then
            m_gsOperator = sName
            m_gsOperatorPass = sPassword
            m_gbManufacturer = False
            m_gbSuperMan = True
            m_gbSystemMan = True
            
            OK = True
            Me.Hide
        Else
            MsgBox "密码错误,再试一次!", vbOKOnly + vbCritical, "登录"
            txtPassword.SetFocus
            txtPassword.SelStart = 0
            txtPassword.SelLength = Len(txtPassword.Text)
            Exit Sub
        End If
    Else
        With OperatorRs
            If Not (.EOF And .BOF) Then
                .MoveFirst
            End If
            .Find "FName = '" & sName & "'"
            If .EOF Then                    '没找到
                MsgBox "您所输入的操作员姓名无效!", vbOKOnly + vbInformation, "提示:"
                txtName.SetFocus
                Exit Sub
            Else
                Dim sTemp As String
                
                If IsNull(![FPassword]) Then
                    sTemp = ""
                Else
                    sTemp = ![FPassword]
                End If
                
                If sTemp = sPassword Then
                    m_gsOperator = sName
                    m_gsOperatorPass = sPassword
                    m_gbManufacturer = False
                    m_gbSuperMan = False
                    m_gbSystemMan = IIf(![FAttribute] = 1, True, False)
                    
                    OK = True
                    Me.Hide
                Else
                    MsgBox "密码错误,再试一次!", vbOKOnly + vbCritical, "登录"
                    txtPassword.SetFocus
                    txtPassword.SelStart = 0
                    txtPassword.SelLength = Len(txtPassword.Text)
                    Exit Sub
                End If
            End If
        End With
    End If
End Sub

Private Sub Form_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        SendKeys "{Tab}"
    End If
End Sub

Private Sub Form_Load()
    SetForm Me, 9
    
    Set SystemRs = New ADODB.Recordset
    SystemRs.Open "Select * From System", m_gCnAlarm
    
    Set OperatorRs = New ADODB.Recordset
    OperatorRs.Open "Select * From Operator Order by FId", m_gCnAlarm, adOpenStatic, adLockOptimistic, adCmdUnknown
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Set SystemRs = Nothing
    Set OperatorRs = Nothing
End Sub

Private Sub txtId_LostFocus()
    Dim sTemp As String, sId As String
    
    sTemp = Me.ActiveControl.Name
    If UCase(sTemp) = "CMDCANCEL" Then  '击压取消
        Exit Sub
    End If
    
    sId = Trim(txtId.Text)
    If sId = "" Then
        txtName.SetFocus
        Exit Sub
    ElseIf Not IsNumeric(sId) Then
        MsgBox "操作员编码请输入数字!", vbOKOnly + vbInformation, "提示:"
        txtId.SetFocus
        Exit Sub
    End If
    
    If sId = "0" Then           '默认系统主管编码位"0"
        txtName.Text = SystemRs![FManager]
        txtPassword.Text = ""
        txtPassword.SetFocus
    Else
        With OperatorRs
            If Not (.EOF And .BOF) Then
                .MoveFirst
            End If
            .Find "FId =" & sId
            If .EOF Then        '没找到
                MsgBox "您所输入的操作员编码无效!", vbOKOnly + vbInformation, "提示:"
                txtId.SetFocus
                Exit Sub
            Else
                txtName.Text = ![FName]
                txtPassword.Text = ""
                txtPassword.SetFocus
            End If
        End With
    End If
End Sub

⌨️ 快捷键说明

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