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

📄 frmlogin.frm

📁 在Visual Basic环境下实现的名片管理系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmLogin 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "记事本-通讯录"
   ClientHeight    =   3510
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   5355
   Icon            =   "frmLogin.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   Palette         =   "frmLogin.frx":08CA
   ScaleHeight     =   3510
   ScaleWidth      =   5355
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton Command1 
      Cancel          =   -1  'True
      Caption         =   "取消"
      Height          =   315
      Index           =   1
      Left            =   1440
      TabIndex        =   5
      Top             =   2970
      Width           =   855
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确定"
      Height          =   315
      Index           =   0
      Left            =   420
      TabIndex        =   4
      Top             =   2970
      Width           =   855
   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
      IMEMode         =   3  'DISABLE
      Index           =   1
      Left            =   990
      PasswordChar    =   "*"
      TabIndex        =   3
      Top             =   2460
      Width           =   1335
   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
      Index           =   0
      Left            =   990
      TabIndex        =   2
      Top             =   2040
      Width           =   1335
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "密 码"
      ForeColor       =   &H000000FF&
      Height          =   180
      Left            =   390
      TabIndex        =   1
      Top             =   2550
      Width           =   450
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "用户名"
      ForeColor       =   &H000000FF&
      Height          =   180
      Left            =   390
      TabIndex        =   0
      Top             =   2130
      Width           =   540
   End
   Begin VB.Image Image1 
      Height          =   3660
      Left            =   -30
      Picture         =   "frmLogin.frx":21B0
      Stretch         =   -1  'True
      Top             =   -60
      Width           =   5415
   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 OK As Boolean
Dim RecSet As New ADODB.Recordset

Private Sub Command1_Click(Index As Integer)
    If Index = 1 Then Unload Me
    If Index = 0 Then
        Dim TT As String
        If LenB(Text1(Index)) = 0 Then Exit Sub
        If Not (RecSet.EOF Or RecSet.BOF) Then TT = IIf(IsNull(RecSet("f002")), "", RecSet("f002"))
        If TT <> Trim(Text1(1)) Then
            MsgBox "无效的用户密码,请重试!", vbExclamation, "登录错误"
            Text1(1).SetFocus
            Exit Sub
        End If
        UserCode = RecSet.Fields("f001")
        UserName = RecSet.Fields("f003")
        frmMain.Show
        Unload Me
    End If
End Sub

Private Sub Form_Load()
    MyOpen RecSet, "select * from c001"
End Sub

Private Sub Text1_GotFocus(Index As Integer)
    Text1(Index).SelStart = 0
    Text1(Index).SelLength = Len(Text1(Index))
End Sub

Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
    If KeyAscii = 13 Then
        SendKeys "{Tab}"
    End If
End Sub

Private Sub Text1_Validate(Index As Integer, Cancel As Boolean)
    If LenB(Text1(0)) = 0 And LenB(Text1(1)) = 0 Then
        Cancel = True
        Exit Sub
    End If
    If RecSet.EOF Or RecSet.BOF Then Exit Sub
    RecSet.MoveFirst
    RecSet.Find "f001='" & Text1(0).Text & "'"
    If RecSet.EOF Then
      Cancel = True
    Else
      Cancel = False
      'Label2 = Recset.Fields("f003")
    End If
End Sub

⌨️ 快捷键说明

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