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

📄 frmlogin.frm

📁 学生信息管理系统 毕业设计 vb+sql
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmLogin 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "登录"
   ClientHeight    =   6420
   ClientLeft      =   2835
   ClientTop       =   3480
   ClientWidth     =   8535
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   Picture         =   "frmLogin.frx":0000
   ScaleHeight     =   3793.149
   ScaleMode       =   0  'User
   ScaleWidth      =   8013.903
   ShowInTaskbar   =   0   'False
   Begin VB.TextBox txtUserName 
      BackColor       =   &H00E0E0E0&
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   585
      Left            =   2400
      TabIndex        =   0
      Top             =   1440
      Width           =   2325
   End
   Begin VB.CommandButton cmdOK 
      BackColor       =   &H00C0C0C0&
      Caption         =   "确 定"
      Default         =   -1  'True
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   1080
      TabIndex        =   2
      Top             =   4560
      Width           =   1500
   End
   Begin VB.CommandButton cmdCancel 
      Cancel          =   -1  'True
      Caption         =   "取 消"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   3840
      TabIndex        =   3
      Top             =   4560
      Width           =   1500
   End
   Begin VB.TextBox txtPassword 
      BackColor       =   &H00E0E0E0&
      Height          =   585
      IMEMode         =   3  'DISABLE
      Left            =   2400
      PasswordChar    =   "*"
      TabIndex        =   1
      Top             =   2640
      Width           =   2325
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      Caption         =   "学生信息管理系统"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   26.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H0000FF00&
      Height          =   975
      Left            =   1440
      TabIndex        =   6
      Top             =   360
      Width           =   4335
   End
   Begin VB.Label lblLabels 
      BackStyle       =   0  'Transparent
      Caption         =   "密码"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   18
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H0000FF00&
      Height          =   375
      Index           =   1
      Left            =   960
      TabIndex        =   5
      Top             =   2760
      Width           =   960
   End
   Begin VB.Label lblLabels 
      Alignment       =   2  'Center
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "用户名"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   18
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H0000FF00&
      Height          =   360
      Index           =   0
      Left            =   960
      TabIndex        =   4
      Top             =   1440
      Width           =   1140
   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
    Me.Hide
End Sub

Private Sub cmdOK_Click()
Dim txtsql As String, mrc As Adodb.Recordset, msgtext As String, username As String, micount As Integer
    username = ""
   If Trim(txtusername.Text) = "" Then
      MsgBox "用户名不为空,请重新输入!", vbOKOnly + vbExclamation, "警告"
      txtusername.SelStart = 0: txtusername.SelLength = Len(txtusername.Text)
     txtusername.SetFocus: Exit Sub
   Else
     txtsql = "select * from user_info where user_id='" & Trim(txtusername.Text) & "'"
     Set mrc = executesql(txtsql, msgtext)
    If mrc.EOF = True Then
       MsgBox "用户名出错,请重新输入!", vbOKOnly + vbExclamation, "警告"
       txtusername.SelStart = 0: txtusername.SelLength = Len(txtusername.Text)
       txtusername.SetFocus: Exit Sub
   Else
       If Trim(mrc.Fields(1)) = Trim(txtPassword.Text) Then
       mrc.Close: username = Trim(txtusername.Text)
       FrmMain.Show
       Unload Me
   Else
      MsgBox "密码出错,请重新输入!", vbOKOnly + vbExclamation, "警告"
      txtPassword.Text = "": txtPassword.SetFocus
      Exit Sub
   End If
  End If
End If
micount = micount + 1
If micount = 3 Then
   MsgBox "尝试数超过3次,你无权使用本序", vbExclamation, "警告"
   End
End If
    
End Sub

⌨️ 快捷键说明

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