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

📄 frmlogin.frm

📁 vb做的数据库 客户管理系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmLogin 
   Appearance      =   0  'Flat
   AutoRedraw      =   -1  'True
   BackColor       =   &H80000005&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "身份验证"
   ClientHeight    =   2955
   ClientLeft      =   45
   ClientTop       =   375
   ClientWidth     =   5415
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2955
   ScaleWidth      =   5415
   StartUpPosition =   2  '屏幕中心
   Begin khgl.chameleonButton Cmd_Cancel 
      Height          =   315
      Left            =   3000
      TabIndex        =   6
      Top             =   2340
      Width           =   1155
      _ExtentX        =   2037
      _ExtentY        =   556
      BTYPE           =   3
      TX              =   "取消  "
      ENAB            =   -1  'True
      BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      COLTYPE         =   1
      FOCUSR          =   -1  'True
      BCOL            =   14215660
      FCOL            =   0
   End
   Begin khgl.chameleonButton Cmd_Ok 
      Height          =   315
      Left            =   1140
      TabIndex        =   5
      Top             =   2340
      Width           =   1155
      _ExtentX        =   2037
      _ExtentY        =   556
      BTYPE           =   3
      TX              =   "确定  "
      ENAB            =   -1  'True
      BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      COLTYPE         =   1
      FOCUSR          =   -1  'True
      BCOL            =   14215660
      FCOL            =   0
   End
   Begin VB.Frame Frame1 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      ForeColor       =   &H80000008&
      Height          =   1815
      Left            =   420
      TabIndex        =   0
      Top             =   240
      Width           =   4635
      Begin VB.TextBox txtPwd 
         Height          =   315
         IMEMode         =   3  'DISABLE
         Left            =   1680
         PasswordChar    =   "*"
         TabIndex        =   4
         Top             =   1140
         Width           =   2175
      End
      Begin VB.TextBox txtUser 
         Height          =   315
         Left            =   1680
         TabIndex        =   3
         Top             =   480
         Width           =   2115
      End
      Begin VB.Label Label2 
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         Caption         =   "密码"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   375
         Left            =   720
         TabIndex        =   2
         Top             =   1140
         Width           =   795
      End
      Begin VB.Label Label1 
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         Caption         =   "用户名"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   375
         Left            =   660
         TabIndex        =   1
         Top             =   540
         Width           =   795
      End
   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 PasswordKey As String
Public NameKey As String
Public Try_times As Integer

Private Sub Cmd_Cancel_Click()
End
End Sub

Private Sub Cmd_OK_Click()
 Dim j As Single
  
'数据有效性检查
  If txtUser = "" Then
    MsgBox "请输入用户名"
    txtUser.SetFocus
    Exit Sub
  End If
  If txtPwd = "" Then
    MsgBox "请输入密码"
    txtPwd.SetFocus
    Exit Sub
  End If

  NameKey = MakeStr(txtUser)
  PasswordKey = MakeStr(txtPwd)
   
'判断用户是否存在
  If MyUser.In_DB(NameKey) = False Then
    MsgBox "用户名不存在"
    Try_times = Try_times + 1
    If Try_times >= 3 Then
        MsgBox "您已经三次尝试进入本系统,均不成功,系统将关闭"
        DBapi_Disconnect
    End
    Else
        Exit Sub
    End If
  End If

  '判断密码是否正确
  MyUser.GetInfo (NameKey)
  If MyUser.UserPwd <> PasswordKey Then
    MsgBox "密码错误"
    Try_times = Try_times + 1
    If Try_times >= 3 Then
      MsgBox "您已经三次尝试进入本系统,均不成功,系统将关闭"
      DBapi_Disconnect
      End
    Else
      Exit Sub
    End If
  End If
  
'登录成功,将当前用户的信息保存在CurUser中
 CurUser.GetInfo (MyUser.UserName)
'关闭自己
  Unload Me
   frmMain.Show
End Sub

⌨️ 快捷键说明

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