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

📄 frmlogin.frm

📁 一个简单的VB开发环境的学生管理系统.请各位大虾们多多指教
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form FrmLogIn 
   Caption         =   "登陆窗体"
   ClientHeight    =   4275
   ClientLeft      =   60
   ClientTop       =   420
   ClientWidth     =   6390
   BeginProperty Font 
      Name            =   "隶书"
      Size            =   15
      Charset         =   134
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   ForeColor       =   &H00808080&
   Icon            =   "FrmLogIn.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   Picture         =   "FrmLogIn.frx":27A2
   ScaleHeight     =   4275
   ScaleWidth      =   6390
   StartUpPosition =   2  '屏幕中心
   Begin MSAdodcLib.Adodc Adodcuse 
      Height          =   330
      Left            =   1200
      Top             =   120
      Visible         =   0   'False
      Width           =   2655
      _ExtentX        =   4683
      _ExtentY        =   582
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   2
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   $"FrmLogIn.frx":2F325
      OLEDBString     =   $"FrmLogIn.frx":2F3B2
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   "用户表"
      Caption         =   "Adodc1"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "隶书"
         Size            =   15
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.CommandButton CmdClose 
      BackColor       =   &H000040C0&
      Cancel          =   -1  'True
      Caption         =   "取消"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   18
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Left            =   4560
      TabIndex        =   6
      Top             =   2880
      Width           =   1695
   End
   Begin VB.CommandButton CmdLogIn 
      Caption         =   "登陆"
      Default         =   -1  'True
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   18
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   735
      Left            =   4560
      Picture         =   "FrmLogIn.frx":2F43F
      Style           =   1  'Graphical
      TabIndex        =   5
      Top             =   1560
      Width           =   1695
   End
   Begin VB.TextBox txtpasswords 
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00000080&
      Height          =   495
      IMEMode         =   3  'DISABLE
      Left            =   1920
      PasswordChar    =   "*"
      TabIndex        =   4
      Top             =   3000
      Width           =   2460
   End
   Begin VB.TextBox txtuser 
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00000080&
      Height          =   495
      Left            =   1920
      TabIndex        =   2
      Top             =   1680
      Width           =   2460
   End
   Begin VB.Label LabelPwd 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "密 码(&P)"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   15.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C000C0&
      Height          =   315
      Left            =   120
      TabIndex        =   3
      Top             =   3120
      Width           =   1320
   End
   Begin VB.Label LabelUse 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "用户名(&U)"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   15.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C000C0&
      Height          =   315
      Left            =   120
      TabIndex        =   1
      Top             =   1680
      Width           =   1485
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "学生信息管理系统"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   36
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C000C0&
      Height          =   720
      Left            =   360
      TabIndex        =   0
      Top             =   600
      Width           =   5880
   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 rs As ADODB.Recordset

Private Sub CmdClose_Click()
Unload Me
End Sub

Private Sub CmdLogIn_Click()
                           Dim r As Integer
     If Trim(txtuser.Text) = "" Then
                            MsgBox "对不起,您的用户名为空,请从新输入!", vbExclamation, "提示信息"
                                  txtuser.SetFocus    '获得焦点
        Else
                    loginname = txtuser.Text
             End If
        If LenB(txtuser.Text) <= 6 Then    '求字符串子节数
             MsgBox "对不起,您的用户名长度小于6位,请从新输入!", vbExclamation, "提示信息"
                  txtuser.SetFocus
        End If
               If Trim(txtpasswords.Text) = "" Then
                 MsgBox "对不起, ! 您的密码为空,请从新输入     ", vbExclamation, "提示信息"
                           txtpasswords.SetFocus: Exit Sub
               End If
               If Len(txtpasswords.Text) <= 8 Then
                   MsgBox "对不起, ! 您的密码长度小于8位,请从新输入     ", vbExclamation, "提示信息"
                           txtpasswords.SetFocus: Exit Sub
                     End If
Adodcuse.CommandType = adCmdText
Adodcuse.RecordSource = "select * from 用户表 "
Adodcuse.Refresh
Set rs = Adodcuse.Recordset
Do While Not rs.EOF
If Trim(rs.Fields("用户名")) = Trim(txtuser.Text) Then
    
        If Trim(rs.Fields("密码")) <> Trim(txtpasswords.Text) Then
                     r = r + 1
                 MsgBox "对不起, ! 您的密码错误,请从新输入     ", vbExclamation, "提示信息"
                txtpasswords = "": txtpasswords.SetFocus
                Exit Sub
             If r >= 3 Then
                  MsgBox "对不起,密码已重复三次 ! 您无权使用该系统!", vbExclamation, "提示信息"
                Unload Me
                Exit Sub
              End If
         Else
         Adodcuse.RecordSource = "select 权限 from 用户表 where 用户名='" & txtuser.Text & "'"
                 Set rs = Adodcuse.Recordset
                      Adodcuse.Refresh
                  If Trim(rs.Fields("权限")) = "用户" Then
                    MDIFrm.deluser.Visible = False
                    MDIFrm.adduser.Visible = False
                    MDIFrm.Toolbar1.Buttons.Item(1).Enabled = False
                    MDIFrm.Toolbar1.Buttons.Item(2).Enabled = False
                Else
                MDIFrm.deluser.Visible = True
                    MDIFrm.adduser.Visible = True
                    MDIFrm.Toolbar1.Buttons.Item(1).Enabled = True
                    MDIFrm.Toolbar1.Buttons.Item(2).Enabled = True
                End If
                         Unload FrmLogIn
                         MDIFrm.Show
         Exit Sub
         End If
 Else: rs.MoveNext
   End If
   Loop
          MsgBox "对不起,没有此用户名 ! 您无权使用该系统!", vbExclamation, "提示信息"
          
End Sub
Private Sub txtuser_LostFocus()
If txtuser.Text = "" Then MsgBox "用户名 不能为 空 !"
End Sub

⌨️ 快捷键说明

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