forlogin.frm

来自「源码+论文 vB+access的毕业设计,请大家参考」· FRM 代码 · 共 173 行

FRM
173
字号
VERSION 5.00
Object = "{E95A2510-F3D1-416D-823B-4F840FE98091}#3.0#0"; "Command.ocx"
Begin VB.Form frmlogin 
   BackColor       =   &H00C0FFC0&
   BorderStyle     =   0  'None
   Caption         =   "登录"
   ClientHeight    =   2355
   ClientLeft      =   5430
   ClientTop       =   3840
   ClientWidth     =   3855
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2355
   ScaleWidth      =   3855
   ShowInTaskbar   =   0   'False
   Begin CSCommand.Command Command2 
      Height          =   375
      Left            =   2280
      TabIndex        =   6
      Top             =   1800
      Width           =   855
      _ExtentX        =   1508
      _ExtentY        =   661
      IconAlign       =   0
      Icon            =   "forlogin.frx":0000
      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 Command1 
      Height          =   375
      Left            =   840
      TabIndex        =   5
      Top             =   1800
      Width           =   855
      _ExtentX        =   1508
      _ExtentY        =   661
      IconAlign       =   0
      Icon            =   "forlogin.frx":001C
      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.Frame Frame1 
      BackColor       =   &H00C0FFC0&
      Height          =   1575
      Left            =   240
      TabIndex        =   0
      Top             =   120
      Width           =   3375
      Begin VB.TextBox Text2 
         Height          =   290
         Left            =   1440
         TabIndex        =   4
         Top             =   840
         Width           =   1695
      End
      Begin VB.TextBox Text1 
         Height          =   290
         Left            =   1440
         TabIndex        =   3
         Top             =   290
         Width           =   1695
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         BackColor       =   &H00C0FFC0&
         Caption         =   "口令:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   14.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         Left            =   360
         TabIndex        =   2
         Top             =   840
         Width           =   855
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         BackColor       =   &H00C0FFC0&
         Caption         =   "用户名:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   14.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00000000&
         Height          =   285
         Left            =   360
         TabIndex        =   1
         Top             =   240
         Width           =   1140
      End
   End
End
Attribute VB_Name = "frmlogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub Command1_Click()
Dim mrc As ADODB.Recordset
txtSQL = "select username from use where username='" & Trim(Text1.Text) & "'"
Set mrc = ExecuteSQL(txtSQL)
If mrc.EOF = True Then
  MsgBox " 用户名错误!", vbExclamation + vbOKOnly, "警告"
  Text1.SetFocus
  Text1.SelStart = 0
  Text1.SelLength = Len(Text1.Text)
  Exit Sub
End If
username = mrc.Fields(0)
txtSQL = "select username from use where password='" & Trim(Text2.Text) & "'"
Set mrc = ExecuteSQL(txtSQL)
If mrc.EOF = True Then
  MsgBox " 密码错误!", vbExclamation + vbOKOnly, "警告"
  Text2.SetFocus
  Text2.SelStart = 0
  Text2.SelLength = Len(Text2.Text)
  Exit Sub
End If

MDIMain.Show
Unload Me
End Sub

Private Sub Command2_Click()
Unload Me
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
 Command1.SetFocus
End If
End Sub

⌨️ 快捷键说明

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