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

📄 frmlogin.frm

📁 一套鞋厂的销售管理系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmLogin 
   BorderStyle     =   4  'Fixed ToolWindow
   Caption         =   "请选择进入系统的用户"
   ClientHeight    =   1980
   ClientLeft      =   2835
   ClientTop       =   3435
   ClientWidth     =   3705
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   1169.849
   ScaleMode       =   0  'User
   ScaleWidth      =   3478.794
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   Begin VB.ComboBox username 
      Height          =   315
      Left            =   1320
      TabIndex        =   0
      Top             =   120
      Width           =   1935
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "确定"
      Default         =   -1  'True
      Height          =   360
      Left            =   615
      Style           =   1  'Graphical
      TabIndex        =   2
      Top             =   1320
      Width           =   1035
   End
   Begin VB.CommandButton cmdCancel 
      Cancel          =   -1  'True
      Caption         =   "取消"
      Height          =   360
      Left            =   2130
      Style           =   1  'Graphical
      TabIndex        =   3
      Top             =   1335
      Width           =   1050
   End
   Begin VB.TextBox txtPassword 
      Height          =   345
      IMEMode         =   3  'DISABLE
      Left            =   1290
      PasswordChar    =   "*"
      TabIndex        =   1
      Top             =   645
      Width           =   1950
   End
   Begin VB.Label lblLabels 
      Caption         =   "用户名称(&U):"
      Height          =   270
      Index           =   0
      Left            =   195
      TabIndex        =   4
      Top             =   150
      Width           =   1080
   End
   Begin VB.Label lblLabels 
      Caption         =   "密   码(&P):"
      Height          =   270
      Index           =   1
      Left            =   195
      TabIndex        =   5
      Top             =   660
      Width           =   1080
   End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private rs As ADODB.Recordset
Public LoginSucceeded As Boolean
Private str As String
Private f As Integer

Private Sub cmdCancel_Click()
    '设置全局变量为 false
    '不提示失败的登录
    LoginSucceeded = False
    End
End Sub

Private Sub cmdOK_Click()
    '检查正确的密码
    LoginSucceeded = False
    If username.Text = "" Or txtPassword.Text = "" Then
        username.SetFocus
        SendKeys "{Home}+{End}"
        MsgBox "无效的用户名或密码,请重试!", , "登录"
    Else
        rs.Open "select name, password from password where name='" & Trim(Me.username) & "'", GetConnect, adOpenStatic, adLockReadOnly
        If rs.EOF And rs.BOF Then
            MsgBox "未找到此用户?", , "登录"
        Else
            str = rs![Password]
            If Trim(str) = Trim(txtPassword.Text) Then
                LoginSucceeded = True
            Else
                f = f + 1
                MsgBox "第 " & f & " 密码错误?", , "登录"
                If f = 3 Then
                   End
                End If
            End If
        End If
        rs.Close
        If LoginSucceeded Then
            GetConnect
            'Unload pub_Splash
            Unload Me
            frmMain.Show
        End If
    End If
End Sub

Private Sub Form_Load()
Dim i As Integer
 Set rs = New ADODB.Recordset
 rs.Open "select name from password", GetConnect, adOpenStatic, adLockReadOnly
 Do Until rs.EOF
    Me.username.AddItem rs![Name]
    rs.MoveNext
 Loop
 rs.Close
End Sub

⌨️ 快捷键说明

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