frmlogin.frm

来自「学生信息管理系统,学生入学时间及毕业时间,学生成绩,学生所在系」· FRM 代码 · 共 245 行

FRM
245
字号
VERSION 5.00
Begin VB.Form FrmLogin 
   BackColor       =   &H00E7DFE7&
   BorderStyle     =   0  'None
   Caption         =   "登录"
   ClientHeight    =   4560
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   5520
   ClipControls    =   0   'False
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   Picture         =   "FrmLogin.frx":0000
   ScaleHeight     =   4560
   ScaleWidth      =   5520
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton cmdCancel 
      Cancel          =   -1  'True
      Caption         =   "取消"
      Height          =   495
      Left            =   3240
      TabIndex        =   8
      Top             =   3720
      Width           =   1575
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "确定"
      Height          =   495
      Left            =   600
      TabIndex        =   7
      Top             =   3720
      Width           =   1575
   End
   Begin VB.TextBox txtUserID 
      Height          =   360
      IMEMode         =   3  'DISABLE
      Left            =   1680
      TabIndex        =   1
      Top             =   1440
      Width           =   2295
   End
   Begin VB.TextBox txtUserName 
      BackColor       =   &H00E7DFE7&
      Height          =   360
      Left            =   1680
      Locked          =   -1  'True
      TabIndex        =   5
      TabStop         =   0   'False
      Top             =   2160
      Width           =   2295
   End
   Begin VB.TextBox txtPass 
      Height          =   360
      IMEMode         =   3  'DISABLE
      Left            =   1680
      MaxLength       =   12
      PasswordChar    =   "*"
      TabIndex        =   3
      Top             =   2880
      Width           =   2295
   End
   Begin VB.Label Label2 
      BackColor       =   &H80000005&
      Caption         =   "欢迎使用学生学籍管理系统"
      BeginProperty Font 
         Name            =   "微软雅黑"
         Size            =   15.75
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000000FF&
      Height          =   375
      Left            =   840
      TabIndex        =   6
      Top             =   480
      Width           =   3855
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "用户编号:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Left            =   480
      TabIndex        =   0
      Top             =   1560
      Width           =   1050
   End
   Begin VB.Label lblLabels 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "密    码:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Index           =   1
      Left            =   480
      TabIndex        =   2
      Top             =   3000
      Width           =   945
   End
   Begin VB.Label lblLabels 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "用 户 名:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Index           =   0
      Left            =   480
      TabIndex        =   4
      Top             =   2280
      Width           =   945
   End
End
Attribute VB_Name = "FrmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim MyLogin As OpenRs
Dim UseridSQL As String
Dim Level As Integer
Public CurrentUser As String
Private Sub Cmdcancel_Click()
Unload Me
End Sub

Private Sub cmdOK_Click()
If txtUserid.Text = "Administrator" And txtPass.Text = "ACCP2002" Then
    Unload Me
    FrmMain.Show
    Exit Sub
End If

If txtUserid.Text = "" Then
   MsgBox "请输入用户编号!", vbOKOnly + vbInformation, "用户登陆"
   txtUserid.SetFocus
   Exit Sub
Else
   UseridSQL = "select * from User_Info where user_Id='" & txtUserid.Text & "'"
   MyLogin.rsDK1 UseridSQL
   If MyLogin.rs1.EOF = False Then
      txtUsername.Text = Trim(MyLogin.rs1!user_name)
      Level = MyLogin.rs1!user_level
      If txtPass.Text = Trim(MyLogin.rs1!user_pwd) Then
         CurrentUser = Trim(MyLogin.rs1!user_name)
         Call DisplayMenu
         Unload Me
         FrmMain.Show
      Else
         MsgBox "密码错误!" & vbCrLf & vbCrLf & "请重新输入!", vbOKOnly + vbInformation, "用户登陆"
         txtPass.Text = ""
         txtPass.SetFocus
         Exit Sub
      End If
   Else
      MsgBox "用户编号不存在!" & vbCrLf & vbCrLf & "请重新输入!", vbOKOnly + vbInformation, "用户登陆"
      txtUserid.Text = ""
      txtUserid.SetFocus
      Exit Sub
   End If
   
End If
End Sub

Private Sub Form_Load()
Set MyLogin = New OpenRs
End Sub

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

Private Sub txtUserId_Change()
txtPass.Text = ""
txtUsername.Text = ""
End Sub

Private Sub txtUserId_KeyPress(KeyAscii As Integer)
If KeyAscii = 39 Then
   KeyAscii = 0
ElseIf KeyAscii = 13 Then
   txtPass.SetFocus
End If
End Sub

Private Sub txtUserId_LostFocus()
UseridSQL = "select * from User_Info where user_Id='" & txtUserid.Text & "'"
   MyLogin.rsDK1 UseridSQL
   If MyLogin.rs1.EOF = False Then
      txtUsername.Text = Trim(MyLogin.rs1!user_name)
   End If
End Sub

Private Sub DisplayMenu()
If Level = 2 Then
   FrmMain.mnuBackUpDB.Visible = False
   FrmMain.mnuRestoreDB.Visible = False
   FrmMain.mnuline1.Visible = False
   FrmMain.mnuAddUser.Visible = False
   FrmMain.mnuDeleteUser.Visible = False
ElseIf Level = 3 Then
   FrmMain.mnuBackUpDB.Visible = False
   FrmMain.mnuRestoreDB.Visible = False
   FrmMain.mnuline1.Visible = False
   FrmMain.mnuUserManage.Visible = False
   FrmMain.mnuGrade.Visible = False
   FrmMain.mnuClass.Visible = False
   FrmMain.mnuCourseInfo.Visible = False
   FrmMain.mnuStudentInfo.Visible = False
   FrmMain.mnuResult.Visible = False
End If
End Sub

⌨️ 快捷键说明

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