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

📄 frmlogin.frm

📁 我就不做什么介绍了.你们打家假如要管理系统的话就下下来自己看吧
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmLogin 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "登录"
   ClientHeight    =   3240
   ClientLeft      =   2835
   ClientTop       =   3480
   ClientWidth     =   6270
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   1914.299
   ScaleMode       =   0  'User
   ScaleWidth      =   5887.19
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin VB.Frame Frame2 
      Height          =   135
      Left            =   0
      TabIndex        =   7
      Top             =   2040
      Width           =   6495
   End
   Begin VB.CommandButton cmdCancel 
      Cancel          =   -1  'True
      Caption         =   "取消"
      Height          =   390
      Left            =   4080
      TabIndex        =   4
      Top             =   2520
      Width           =   1140
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "确定"
      Default         =   -1  'True
      Height          =   390
      Left            =   2640
      TabIndex        =   3
      Top             =   2520
      Width           =   1140
   End
   Begin VB.Frame Frame1 
      Height          =   1815
      Left            =   1200
      TabIndex        =   0
      Top             =   120
      Width           =   4935
      Begin VB.ComboBox cboUserName 
         Height          =   300
         Left            =   1545
         TabIndex        =   1
         Top             =   360
         Width           =   2325
      End
      Begin VB.TextBox txtPassword 
         Height          =   345
         IMEMode         =   3  'DISABLE
         Left            =   1560
         PasswordChar    =   "*"
         TabIndex        =   2
         Top             =   1005
         Width           =   2325
      End
      Begin VB.Label lblLabels 
         Caption         =   "密码(&P):"
         Height          =   270
         Index           =   1
         Left            =   360
         TabIndex        =   6
         Top             =   1042
         Width           =   1080
      End
      Begin VB.Label lblLabels 
         Caption         =   "用户名称(&U):"
         Height          =   270
         Index           =   0
         Left            =   360
         TabIndex        =   5
         Top             =   375
         Width           =   1080
      End
   End
   Begin VB.Image Image1 
      Height          =   1695
      Left            =   120
      Picture         =   "frmLogin.frx":0000
      Stretch         =   -1  'True
      Top             =   240
      Width           =   975
   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 mclsMidTier As clsMidTier
Dim rs As Recordset
Dim strCmd As String

Public LoginSucceeded As Boolean
Private Sub cboUserName_LostFocus()
   '全局用户名
   UserName = cboUserName.Text
End Sub

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

Private Sub cmdOK_Click()
   Dim strFindUser As String
   Dim strCondition As String
   
   strFindUser = cboUserName.Text
   strCmd = "Select UserName,UserPassword From UserInfo "
   strCondition = "UserName='" & strFindUser & "'"
   
   Set rs = mclsMidTier.GetList(strCmd, strCondition)
   
   If Not rs.BOF Then
      rs.MoveFirst
   End If
   
    '检查正确的密码
   If rs.RecordCount <> 0 Then
      If rs("UserPassword") = txtPassword.Text Then
         LoginSucceeded = True
         
         Load frmMDIMain
         frmMDIMain.Show
         Unload Me
      ElseIf rs("UserPassword") <> txtPassword.Text Then
         MsgBox "无效的密码,请重试!", vbOKOnly + vbExclamation, "登录提示"
         txtPassword.SetFocus
         SendKeys "{Home}+{End}"
      End If
   End If
End Sub

Private Sub cboUserName_KeyPress(KeyAscii As Integer)
   If KeyAscii = 13 Then
      KeyAscii = 0
      SendKeys "{Tab}"
    End If
End Sub

Private Sub Form_Load()
   Set mclsMidTier = New clsMidTier
   
   Set rs = mclsMidTier.GetList("select * from UserInfo")
   If rs.RecordCount = 0 Then
      rs.AddNew
      rs("UserName") = "System"
      rs("UserPassword") = "123456"
      rs.Update
    Else
      rs.MoveFirst
    End If
    Do While Not rs.EOF
       cboUserName.AddItem rs("UserName")
       rs.MoveNext
    Loop

End Sub

Private Sub Form_Unload(Cancel As Integer)
   rs.Close
   Set rs = Nothing
   Set mclsMidTier = Nothing
End Sub

⌨️ 快捷键说明

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