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

📄 frmlogin.frm

📁 采用VB+SQL编写的房屋销售管理系统,
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmlogin 
   Caption         =   "用户登录"
   ClientHeight    =   3090
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   4110
   LinkTopic       =   "Form1"
   ScaleHeight     =   3090
   ScaleWidth      =   4110
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command2 
      Caption         =   "退出"
      Height          =   375
      Left            =   2520
      TabIndex        =   5
      Top             =   2280
      Width           =   855
   End
   Begin VB.CommandButton cmdenter 
      Caption         =   "登录"
      Height          =   375
      Left            =   1080
      TabIndex        =   4
      Top             =   2280
      Width           =   855
   End
   Begin VB.TextBox txtpwd 
      Height          =   375
      IMEMode         =   3  'DISABLE
      Left            =   2040
      PasswordChar    =   "*"
      TabIndex        =   1
      Top             =   1320
      Width           =   1095
   End
   Begin VB.TextBox txtname 
      Height          =   375
      Left            =   2040
      TabIndex        =   0
      Top             =   360
      Width           =   1095
   End
   Begin VB.Label Label2 
      Caption         =   "密码"
      Height          =   495
      Left            =   1080
      TabIndex        =   3
      Top             =   1320
      Width           =   1095
   End
   Begin VB.Label Label1 
      Caption         =   "用户名"
      Height          =   495
      Left            =   1080
      TabIndex        =   2
      Top             =   360
      Width           =   1095
   End
End
Attribute VB_Name = "frmlogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim Pwdtimes As Integer
Private Sub Bar_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
    On Error Resume Next

    If Button = 1 Then
        ReleaseCapture
        lngReturnValue = SendMessage(hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&)
    End If
End Sub

Private Sub cmdenter_Click()
If Trim(txtname) = "" Then
            MsgBox "对不起,请输入用户名", vbInformation, App.Title
            txtname.SetFocus
            Exit Sub
        End If
        
   
        If InStr(1, txtname.Text, "'") <> 0 Or InStr(1, txtname.Text, "and") <> 0 Or InStr(1, txtname.Text, "or") <> 0 Then
            MsgBox "用户名不合法!", vbInformation, App.Title
            txtname.Text = ""
            txtname.SetFocus
            Exit Sub
        End If


    Dim Login_rs As New ADODB.Recordset
    Login_rs.Open "select 用户名,密码 from 系统管理 where 用户名='" & _
    Trim(txtname.Text) & "'", CN, 1, 3
    
    If Login_rs.EOF Then
        MsgBox "用户名不存在!", vbInformation, App.Title
        txtname.Text = ""
        txtname.SetFocus
        
        Exit Sub
    End If


    If LCase(txtpwd.Text) <> Login_rs(1) Then
        MsgBox "用户密码错误!", vbInformation, App.Title
        txtpwd.Text = ""
        txtpwd.SetFocus
        Pwdtimes = Pwdtimes + 1
            If Pwdtimes >= 3 Then
                MsgBox "密码输入错误超过3次!系统强制退出!", vbInformation, App.Title
            End
        End If
        Exit Sub
    End If

    Set Login_rs = Nothing
    Loginname = LCase(Trim(txtname.Text))
    Access = 1
    Load frmmain
    frmmain.Show
    Unload Me
End Sub

Private Sub Command2_Click()
If MsgBox("确实要退出吗?", vbQuestion + vbYesNo + vbDefaultButton2, App.Title) = vbYes Then _
    Unload Me
End Sub

Private Sub txtname_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then txtpwd.SetFocus
End Sub

Private Sub txtpwd_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then cmdenter_Click
End Sub

⌨️ 快捷键说明

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