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

📄 frmlogin.frm

📁 专卖店POS系统,比较有使用价值.
💻 FRM
字号:
VERSION 5.00
Object = "{0BA686C6-F7D3-101A-993E-0000C0EF6F5E}#1.0#0"; "THREED32.OCX"
Begin VB.Form frmLogin 
   Caption         =   "登录"
   ClientHeight    =   2160
   ClientLeft      =   2850
   ClientTop       =   3495
   ClientWidth     =   4425
   Icon            =   "frmLogin.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   ScaleHeight     =   1276.199
   ScaleMode       =   0  'User
   ScaleWidth      =   4154.835
   StartUpPosition =   2  '屏幕中心
   Begin VB.ComboBox txtUserName 
      BackColor       =   &H000080FF&
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FFFFFF&
      Height          =   330
      Left            =   1500
      Style           =   2  'Dropdown List
      TabIndex        =   1
      Top             =   345
      Width           =   2520
   End
   Begin Threed.SSPanel SSPanel1 
      Height          =   360
      Left            =   90
      TabIndex        =   6
      Top             =   1725
      Width           =   4230
      _Version        =   65536
      _ExtentX        =   7461
      _ExtentY        =   635
      _StockProps     =   15
      Caption         =   "VB中国 WWW.VB-CODE.NET"
      BackColor       =   12632256
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BevelOuter      =   1
      Font3D          =   3
      Begin VB.Image Image1 
         Height          =   480
         Left            =   120
         Picture         =   "frmLogin.frx":08CA
         Top             =   -30
         Width           =   480
      End
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "确定"
      Default         =   -1  'True
      Height          =   390
      Left            =   1500
      TabIndex        =   4
      Top             =   1185
      Width           =   1140
   End
   Begin VB.CommandButton cmdCancel 
      Cancel          =   -1  'True
      Caption         =   "取消"
      Height          =   390
      Left            =   2895
      TabIndex        =   5
      Top             =   1185
      Width           =   1140
   End
   Begin VB.TextBox txtPassword 
      BackColor       =   &H00E0E0E0&
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   330
      IMEMode         =   3  'DISABLE
      Left            =   1500
      PasswordChar    =   "*"
      TabIndex        =   3
      Top             =   750
      Width           =   2520
   End
   Begin VB.Label lblLabels 
      Caption         =   "用户名称(&U):"
      Height          =   270
      Index           =   0
      Left            =   315
      TabIndex        =   0
      Top             =   390
      Width           =   1080
   End
   Begin VB.Label lblLabels 
      Caption         =   "密码(&P):"
      Height          =   270
      Index           =   1
      Left            =   315
      TabIndex        =   2
      Top             =   765
      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
Dim New_Check As New LoginCheck

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

    Unload Me
    
End Sub

Private Sub cmdOK_Click()
  
    Static ErrClick As Integer
          
    '检查正确的密码
     New_Check.DatabaseDSN = adDsn
     New_Check.ConData = ConData
     New_Check.ConStr = ConStr
     New_Check.UserName = txtUserName
     New_Check.Password = txtPassword
     New_Check.GetResult
     
    'If CheckUser(txtUserName, txtPassword) = True Then  '使用CheckUser函数来检查用户名与口令
    If New_Check.Result = True Then
       sUserName = New_Check.UserName
        '将代码放在这里传递
        '成功到 calling 函数
        '设置全局变量时最容易的
        LoginSucceeded = True
        Me.Hide
         '安装权限设置
        frmMain.LoadAuthority
        frmMain.Show
    Else
        '三次之后退出
        ErrClick = ErrClick + 1
        If ErrClick > 2 Then
            MsgBox "对不起,你不能使用该系统!     ", vbCritical, "登录"
            Unload Me
         Else
            MsgBox "无效的密码,请重试!     ", vbInformation, "登录"
            txtPassword.SetFocus
            SendKeys "{Home}+{End}"
        End If
    End If
    
End Sub

Private Sub Label1_Click(Index As Integer)

End Sub

Private Sub Form_Activate()

  txtPassword.SetFocus
  
End Sub

Private Sub Form_Load()

  '建立Login检查对象
  On Error Resume Next
  Dim Con As Database
  Dim rRecord As Recordset
  Dim sSQL As String
  
      Set Con = OpenDatabase(ConData, 0, 0, ConStr)
      sSQL = "Select  * From User"
      Set rRecord = Con.OpenRecordset(sSQL, dbOpenDynaset)
      'rRecord.Open sSql, Con, adOpenStatic, adLockPessimistic, adCmdText
      
   If rRecord.EOF Then
      rRecord.Close
      Con.Close
      Set rRecord = Nothing
      Set Con = Nothing
      MsgBox "系统没有管理员,不能登录!   ", vbInformation

      Exit Sub
    Else
      Do While Not rRecord.EOF
         txtUserName.AddItem rRecord.Fields("UserName")
         rRecord.MoveNext
      Loop
      rRecord.Close
      Con.Close
      Set rRecord = Nothing
      Set Con = Nothing
      Dim UserID As Integer
          UserID = GetSetting(App.EXEName, "Option", "UserID", -1)
      If UserID = -1 Then  '第一次使用时,使用缺省值
         txtUserName.ListIndex = 0
         Exit Sub
         Else
         If txtUserName.ListCount >= UserID Then
            txtUserName.ListIndex = UserID
            Else
            txtUserName.ListIndex = 0
         End If
      End If
       
    End If
  
End Sub

Private Sub Form_Resize()

  If Me.WindowState = 1 Then Exit Sub
  
  On Error Resume Next
  Me.Width = 4545
  Me.Height = 2565
  
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Unload frmSet
    Unload frmAbout
    Unload frmMain
    Unload frmAcount
End Sub

Private Sub txtUserName_Click()

  On Error Resume Next
  SaveSetting App.EXEName, "Option", "UserID", txtUserName.ListIndex
  txtPassword.SetFocus
  
End Sub

⌨️ 快捷键说明

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