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

📄 login_frm.frm

📁 高校学生选课系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form login_frm 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "密码窗口"
   ClientHeight    =   3000
   ClientLeft      =   5850
   ClientTop       =   4950
   ClientWidth     =   4965
   FillColor       =   &H00FF0000&
   ForeColor       =   &H8000000D&
   LinkTopic       =   "Form4"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   Picture         =   "login_frm.frx":0000
   ScaleHeight     =   3000
   ScaleWidth      =   4965
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton cmdCancel 
      Caption         =   "取消(&Cancel)"
      Height          =   372
      Left            =   2400
      MaskColor       =   &H00FF0000&
      TabIndex        =   6
      Top             =   1920
      Width           =   1335
   End
   Begin VB.TextBox Text2 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   315
      IMEMode         =   3  'DISABLE
      Left            =   1800
      PasswordChar    =   "*"
      TabIndex        =   1
      Top             =   1320
      Width           =   1935
   End
   Begin VB.TextBox Text1 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   315
      Left            =   1800
      TabIndex        =   0
      Top             =   720
      Width           =   1935
   End
   Begin VB.CommandButton cmdOK 
      BackColor       =   &H8000000D&
      Caption         =   "确定(&OK)"
      Height          =   372
      Left            =   960
      MaskColor       =   &H00FF0000&
      TabIndex        =   2
      Top             =   1920
      Width           =   1335
   End
   Begin VB.Label Label4 
      BackStyle       =   0  'Transparent
      Caption         =   "  湖南工业大学学生选课系统"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   9
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   -1  'True
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00000000&
      Height          =   255
      Left            =   720
      TabIndex        =   7
      Top             =   2520
      Width           =   2940
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "姓名:"
      BeginProperty Font 
         Name            =   "幼圆"
         Size            =   11.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00000000&
      Height          =   312
      Left            =   792
      TabIndex        =   5
      Top             =   780
      Width           =   972
   End
   Begin VB.Label Label2 
      BackStyle       =   0  'Transparent
      Caption         =   "密码:"
      BeginProperty Font 
         Name            =   "幼圆"
         Size            =   11.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00000000&
      Height          =   375
      Left            =   795
      TabIndex        =   4
      Top             =   1320
      Width           =   1035
   End
   Begin VB.Label Label3 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      Caption         =   "密码输入"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   15.75
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00000000&
      Height          =   315
      Left            =   -600
      TabIndex        =   3
      Top             =   240
      Width           =   4035
   End
   Begin VB.Image Image1 
      Height          =   7200
      Left            =   -2760
      Picture         =   "login_frm.frx":3C372
      Top             =   -2520
      Width           =   9600
   End
End
Attribute VB_Name = "login_frm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public ok As Boolean
Dim MiCount As Integer
Private Const sign = "用户消息框"

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

Private Sub cmdOK_Click()
    Dim txtSql As String
    Dim rs1 As New ADODB.Recordset
    UserName = ""     '全局变量
    Right1 = ""
    
    If Trim(Text1.Text) = "" Then
        MsgBox "没有此用户,请重新输入用户名!", vbExclamation, sign
        Text1.SetFocus
        Exit Sub
    Else
        '验证密码
        txtSql = "SELECT * FROM 密码 WHERE 用户名='" & Trim(Text1.Text) & "'"
        rs1.Open txtSql, con, adOpenDynamic, adLockOptimistic, adCmdText
    
        If rs1.EOF = True Then
            MsgBox "没有此用户,请重新输入!", vbExclamation, sign
            Text1.Text = Empty
            Text1.SetFocus
        Else
            If Trim(Text2.Text) = Trim(rs1.Fields(1)) Then
                ok = True  '标记
                UserName = Trim(Text1.Text)
                OldPassword = Trim(Text2.Text)
                Right1 = Trim(rs1.Fields(2))
                rs1.Close
                Me.Hide
            Else
                MsgBox "密码不正确!请重新输入!", vbExclamation, sign
                Text2.SetFocus
                Text2.Text = ""
            End If
        End If
    End If
    MiCount = MiCount + 1
    If MiCount = 3 Then
        Me.Hide
    End If
End Sub
Private Sub Form_Load()
    ok = False  '标记
    MiCount = 0
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        Text2.SetFocus
    End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        cmdOK.SetFocus
    End If
End Sub

⌨️ 快捷键说明

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