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

📄 frmlogin.frm

📁 学生信息管理系统的设计,包含与数据库的通信接口和密码等.
💻 FRM
字号:
VERSION 5.00
Object = "{E95A2510-F3D1-416D-823B-4F840FE98091}#3.0#0"; "Command.ocx"
Begin VB.Form frmLogin 
   BackColor       =   &H00E0E0E0&
   BorderStyle     =   0  'None
   Caption         =   "登录"
   ClientHeight    =   2760
   ClientLeft      =   2790
   ClientTop       =   3045
   ClientWidth     =   4305
   Icon            =   "frmLogin.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   1630.699
   ScaleMode       =   0  'User
   ScaleWidth      =   4042.162
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin VB.ComboBox txtUserName 
      Height          =   300
      Left            =   1800
      Style           =   2  'Dropdown List
      TabIndex        =   5
      Top             =   960
      Width           =   2325
   End
   Begin CSCommand.Command cmdCancel 
      Height          =   375
      Left            =   2707
      TabIndex        =   4
      Top             =   2160
      Width           =   1215
      _ExtentX        =   2143
      _ExtentY        =   661
      IconAlign       =   0
      Icon            =   "frmLogin.frx":0442
      Caption         =   "取   消"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin CSCommand.Command cmdOK 
      Height          =   375
      Left            =   360
      TabIndex        =   3
      Top             =   2160
      Width           =   1215
      _ExtentX        =   2143
      _ExtentY        =   661
      IconAlign       =   0
      Icon            =   "frmLogin.frx":045E
      Caption         =   "确   定"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin VB.TextBox txtPassword 
      Height          =   300
      IMEMode         =   3  'DISABLE
      Left            =   1800
      PasswordChar    =   "*"
      TabIndex        =   2
      Top             =   1560
      Width           =   2325
   End
   Begin VB.Label Label1 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BackStyle       =   0  'Transparent
      BorderStyle     =   1  'Fixed Single
      Caption         =   "登录"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   10.5
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00400000&
      Height          =   2758
      Left            =   0
      TabIndex        =   6
      Top             =   0
      Width           =   4307
   End
   Begin VB.Image Image1 
      Height          =   480
      Left            =   120
      Picture         =   "frmLogin.frx":047A
      Stretch         =   -1  'True
      Top             =   840
      Width           =   480
   End
   Begin VB.Image Image2 
      Height          =   480
      Left            =   120
      Picture         =   "frmLogin.frx":1DFC
      Stretch         =   -1  'True
      Top             =   1440
      Width           =   480
   End
   Begin VB.Image Image3 
      Height          =   735
      Left            =   0
      Picture         =   "frmLogin.frx":377E
      Stretch         =   -1  'True
      Top             =   0
      Width           =   4290
   End
   Begin VB.Label lblLabels 
      BackColor       =   &H00E0E0E0&
      Caption         =   "用户名称:"
      Height          =   270
      Index           =   0
      Left            =   840
      TabIndex        =   0
      Top             =   960
      Width           =   960
   End
   Begin VB.Label lblLabels 
      BackColor       =   &H00E0E0E0&
      Caption         =   "登录密码:"
      Height          =   270
      Index           =   1
      Left            =   840
      TabIndex        =   1
      Top             =   1560
      Width           =   960
   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 Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpbuffer As String, nSize As Long) As Long
Public OK As Boolean
Dim txtSQL As String
Dim mrc As ADODB.Recordset
Dim MsgText As String
Dim miCount As Integer

Private Sub Form_Load()
    Dim i As Integer
    i = 0
    txtSQL = "select * from user_Form"
    Set mrc = ExecuteSQL(txtSQL, MsgText)
    With txtUserName
        Do While Not mrc.EOF
            i = i + 1
            .AddItem Trim(mrc!user_ID)
            mrc.MoveNext
        Loop
        .ListIndex = i - 1
    End With
    mrc.Close
    OK = False
    miCount = 0
End Sub

Private Sub cmdCancel_Click()
    OK = False
    Me.Hide
End Sub

Private Sub cmdOK_Click()
    
    txtSQL = "select * from user_Form where user_ID = '" & txtUserName.Text & "'"
    Set mrc = ExecuteSQL(txtSQL, MsgText)
    If mrc.EOF = True Then
        MsgBox "没有这个用户,请重新输入用户名!", vbOKOnly + vbExclamation, "警告"
        txtUserName.SetFocus
    Else
        If Trim(mrc.Fields(1)) = Trim(txtPassword.Text) Then
            OK = True
            mrc.Close
            Me.Hide
            UserName = Trim(txtUserName.Text)
        Else
            MsgBox "输入密码不正确,请重新输入!", vbOKOnly + vbExclamation, "警告"
            txtPassword.SetFocus
            txtPassword.Text = ""
        End If
    End If
    miCount = miCount + 1
    If miCount = 3 Then
        Me.Hide
    End If
    Exit Sub
End Sub

Private Sub txtPassword_KeyDown(KeyCode As Integer, Shift As Integer)
    EnterToTab KeyCode
End Sub

Private Sub txtPassword_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        Call cmdOK_Click
    End If
End Sub

Private Sub txtUserName_Click()
    txtPassword.Text = ""
End Sub

Private Sub txtUserName_KeyDown(KeyCode As Integer, Shift As Integer)
    EnterToTab KeyCode
End Sub

⌨️ 快捷键说明

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