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

📄 frmlogin.frm

📁 比较完整的一个客户管理软件
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmLogin 
   BackColor       =   &H00C0E0FF&
   BorderStyle     =   0  'None
   Caption         =   "登录"
   ClientHeight    =   2745
   ClientLeft      =   2790
   ClientTop       =   3150
   ClientWidth     =   4440
   Icon            =   "frmLogin.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   1621.837
   ScaleMode       =   0  'User
   ScaleWidth      =   4168.919
   ShowInTaskbar   =   0   'False
   Begin VB.TextBox txtUserName 
      BackColor       =   &H0080C0FF&
      ForeColor       =   &H00FF0000&
      Height          =   345
      Left            =   1920
      TabIndex        =   1
      Top             =   120
      Width           =   2325
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "确定"
      Default         =   -1  'True
      Height          =   390
      Left            =   2040
      TabIndex        =   4
      Top             =   1320
      Width           =   900
   End
   Begin VB.CommandButton cmdCancel 
      Cancel          =   -1  'True
      Caption         =   "取消"
      Height          =   390
      Left            =   3240
      TabIndex        =   5
      Top             =   1320
      Width           =   900
   End
   Begin VB.TextBox txtPassword 
      BackColor       =   &H0080C0FF&
      ForeColor       =   &H00FF0000&
      Height          =   345
      IMEMode         =   3  'DISABLE
      Left            =   1920
      PasswordChar    =   "*"
      TabIndex        =   3
      Top             =   720
      Width           =   2325
   End
   Begin VB.Image Image1 
      Height          =   480
      Left            =   120
      Picture         =   "frmLogin.frx":0E42
      Top             =   2040
      Width           =   480
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "只有资料管理员才能进入此系统,如果你是请输入你的用户名,及密码!"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   735
      Left            =   720
      TabIndex        =   6
      Top             =   1920
      Width           =   3735
   End
   Begin VB.Label lblLabels 
      BackStyle       =   0  'Transparent
      Caption         =   "用户名称(&U):"
      ForeColor       =   &H00FF0000&
      Height          =   270
      Index           =   0
      Left            =   600
      TabIndex        =   0
      Top             =   240
      Width           =   1080
   End
   Begin VB.Label lblLabels 
      BackStyle       =   0  'Transparent
      Caption         =   "请输入密码(&P):"
      ForeColor       =   &H00FF0000&
      Height          =   270
      Index           =   1
      Left            =   480
      TabIndex        =   2
      Top             =   840
      Width           =   1425
   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 LoginSucceeded As Boolean

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

Private Sub cmdOK_Click()
  Dim sql As String
  Dim RsPW As New ADODB.Recordset
  
 
  
  sql = "select * from 密码表 where UserName = " & "'" & txtUserName & "'"
  
  RsPW.Open sql, cn, adOpenKeyset
  
  If RsPW.RecordCount = 1 Then
      If txtPassword = RsPW("Password") Then
           UserName = Trim(txtUserName.Text)
           LoginSucceeded = True
           Me.Hide
           MDIForm1.Show
      Else
        MsgBox "无效的密码,请重试!", , "登录"
        txtPassword.SetFocus
        RsPW.Close
        SendKeys "{Home}+{End}"
      End If
  Else
        MsgBox "找不到此用户,请检查你的输入是否正确!", vbCritical, "登陆"
        txtUserName.SetFocus
        RsPW.Close
        SendKeys "{Home}+{End}"
  End If
        
End Sub

Private Sub Form_Load()
  cn.ConnectionString = "DSN=Client_DBase;UID=admin;PWD=bluesky;"
  cn.Open
End Sub

⌨️ 快捷键说明

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