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

📄 loginsys.frm

📁 电气设备管理系统信息在社会和经济的发展中所起的作用越来越为人们所重视。信息资源的开发利用水平成为衡量一个国家综合国力的重要标志之一
💻 FRM
字号:
VERSION 5.00
Begin VB.Form LoginSys 
   BackColor       =   &H00E0E0E0&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "管理员登录"
   ClientHeight    =   2625
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4515
   Icon            =   "LoginSys.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2625
   ScaleWidth      =   4515
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton cmdOkCancel 
      BackColor       =   &H00FFFFFF&
      Cancel          =   -1  'True
      Caption         =   "取消"
      Height          =   375
      Index           =   1
      Left            =   2820
      Style           =   1  'Graphical
      TabIndex        =   5
      Top             =   1890
      Width           =   930
   End
   Begin VB.CommandButton cmdOkCancel 
      BackColor       =   &H00FFFFFF&
      Caption         =   "确定"
      Height          =   375
      Index           =   0
      Left            =   1905
      Style           =   1  'Graphical
      TabIndex        =   4
      Top             =   1890
      Width           =   930
   End
   Begin VB.TextBox txtPass 
      Height          =   270
      IMEMode         =   3  'DISABLE
      Left            =   1905
      PasswordChar    =   "*"
      TabIndex        =   3
      Text            =   "Text1"
      Top             =   1410
      Width           =   2040
   End
   Begin VB.ComboBox comPer 
      Height          =   300
      Left            =   1905
      TabIndex        =   2
      Text            =   "Combo1"
      Top             =   960
      Width           =   2055
   End
   Begin VB.Frame Frame2 
      BackColor       =   &H005CE764&
      Height          =   60
      Left            =   -270
      TabIndex        =   6
      Top             =   600
      Width           =   5250
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "请输入您的管理员名及密码"
      ForeColor       =   &H00404040&
      Height          =   180
      Left            =   525
      TabIndex        =   7
      Top             =   315
      Width           =   2160
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackColor       =   &H8000000A&
      BackStyle       =   0  'Transparent
      Caption         =   "密码"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00800000&
      Height          =   210
      Index           =   1
      Left            =   1440
      TabIndex        =   1
      Top             =   1440
      Width           =   420
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackColor       =   &H8000000A&
      BackStyle       =   0  'Transparent
      Caption         =   "管理员"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00800000&
      Height          =   210
      Index           =   0
      Left            =   1245
      TabIndex        =   0
      Top             =   1005
      Width           =   630
   End
   Begin VB.Image Image1 
      Height          =   480
      Left            =   15
      Picture         =   "LoginSys.frx":058A
      Top             =   30
      Width           =   480
   End
   Begin VB.Shape Shape1 
      BackColor       =   &H00D0D0D0&
      BackStyle       =   1  'Opaque
      BorderStyle     =   0  'Transparent
      Height          =   840
      Left            =   -135
      Top             =   -240
      Width           =   5250
   End
End
Attribute VB_Name = "LoginSys"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Asc() As Integer
Dim db As Database
Dim rst As Recordset
Dim Rec As Integer
Private Sub cmdOkCancel_Click(Index As Integer)
Dim i As Integer
'On Error GoTo erend
i = 0
Select Case Index
    Case 0
        If txtPass.Text = "" Or comPer.Text = "" Then
            MsgBox "请选择用户名或输入密码!", 0 + 48, "提示"
            txtPass.SetFocus
            Exit Sub
        End If
        If Val(txtPass.Text) = Asc(comPer.ListIndex) Then
            Mainfrm.Show
            If comPer.Text = "超级用户" Then Mainfrm.MnuOP.Enabled = True
            Unload Me
        Else
            MsgBox "密码错误,请重试!", 0 + 16, "错误"
            txtPass.SetFocus
            Exit Sub
        End If
Case 1
    Unload Me
End Select
Exit Sub
ErEnd:
    MsgBox "登录错误,请重新填写!", vbOKOnly, "不能登录"
End Sub

Private Sub comPer_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    KeyAscii = 0
    txtPass.SetFocus
End If
End Sub

Private Sub Form_Activate()
comPer.SetFocus
End Sub

Private Sub Form_Load()
Set db = Workspaces(0).OpenDatabase(App.Path & "\Database\Data.mdb", False)
Set rst = db.OpenRecordset("Pass", dbOpenTable)

rst.MoveLast
Rec = rst.RecordCount
ReDim Asc(Rec - 1)
rst.MoveFirst
For i = 1 To Rec
    comPer.AddItem rst.Fields("名称")
    Asc(i - 1) = Val(IIf(IsNull(rst.Fields("密码")), "", rst.Fields("密码")))
    rst.MoveNext
    If rst.EOF Then Exit For
Next
comPer.Text = ""
txtPass.Text = ""
End Sub



Private Sub txtPass_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    KeyAscii = 0
    cmdOkCancel_Click 0
End If
End Sub

⌨️ 快捷键说明

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