frmlogin.frm

来自「VB客房管理系统全套(带源码)顾客可以用电话或上网注册的方式预定。其方式不同」· FRM 代码 · 共 194 行

FRM
194
字号
VERSION 5.00
Begin VB.Form frmLogin 
   AutoRedraw      =   -1  'True
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Login"
   ClientHeight    =   3030
   ClientLeft      =   30
   ClientTop       =   330
   ClientWidth     =   4950
   DrawMode        =   11  'Not Xor Pen
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3030
   ScaleWidth      =   4950
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  '窗口缺省
   Tag             =   "Login"
   Begin VB.CommandButton cmdCancel 
      Height          =   360
      Left            =   2700
      Picture         =   "frmLogin.frx":0000
      Style           =   1  'Graphical
      TabIndex        =   5
      Tag             =   "Cancel"
      Top             =   2340
      Width           =   900
   End
   Begin VB.CommandButton cmdOK 
      Default         =   -1  'True
      Height          =   360
      Left            =   1095
      Picture         =   "frmLogin.frx":0244
      Style           =   1  'Graphical
      TabIndex        =   4
      Tag             =   "OK"
      Top             =   2340
      Width           =   900
   End
   Begin VB.TextBox txtPassword 
      Height          =   288
      IMEMode         =   3  'DISABLE
      Left            =   1800
      PasswordChar    =   "*"
      TabIndex        =   1
      Top             =   1848
      Width           =   2325
   End
   Begin VB.TextBox txtUserName 
      Height          =   288
      Left            =   1800
      TabIndex        =   3
      Top             =   1452
      Width           =   2325
   End
   Begin VB.Label Label1 
      Caption         =   "客房管理信息系统"
      BeginProperty Font 
         Name            =   "华文彩云"
         Size            =   24
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000001&
      Height          =   612
      Left            =   480
      TabIndex        =   6
      Top             =   360
      Width           =   4092
   End
   Begin VB.Label lblLabels 
      Caption         =   "密  码:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   252
      Index           =   1
      Left            =   600
      TabIndex        =   0
      Tag             =   "&Password:"
      Top             =   1860
      Width           =   840
   End
   Begin VB.Label lblLabels 
      Caption         =   "用户名:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   252
      Index           =   0
      Left            =   588
      TabIndex        =   2
      Tag             =   "&User Name:"
      Top             =   1476
      Width           =   1080
   End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False


Option Explicit

Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpbuffer As String, nSize As Long) As Long
Public OK As Boolean
Dim mblChange As Boolean
Public txtSQL As String
Dim mrc As ADODB.Recordset



Private Sub Form_Load()
    
    Dim sBuffer As String
    Dim lSize As Long
    sBuffer = Space$(255)
    lSize = Len(sBuffer)
    Call GetUserName(sBuffer, lSize)
    If lSize > 0 Then
        txtUserName.Text = Left$(sBuffer, lSize)
    Else
        txtUserName.Text = vbNullString
    End If
End Sub
Private Sub cmdCancel_Click()
    OK = False
    Me.Hide
End Sub
Private Sub cmdOk_Click()
Dim txtSQL As String
   Dim mrc As ADODB.Recordset
   Dim msgtext As String
  
If Trim(txtUserName.Text) = "" Then
  MsgBox "用户名不能为空,请重新输入!"
   txtUserName.SetFocus
   
 Else
 

  txtSQL = "select * from user_info where username='" & txtUserName.Text & "'"
  
  Set mrc = ExecuteSQL(txtSQL, msgtext)
  txtUserName.SetFocus
   
   txtUserName.Text = ""
     If Trim(mrc.Fields(1)) = Trim(txtPassword.Text) Then
      
      OK = True
         
       Unload Me
      If Trim(mrc.Fields(2)) = "2" Then
      flagMedit = True
      Else: flagMedit = False
      End If
      mrc.Close
      
      
     Else
       MsgBox "密码不正确,请重输入!", vbOKOnly + vbExclamation, ""
       txtPassword.SetFocus
       txtPassword.Text = ""
     End If
  
 End If
 
End Sub

Private Sub txtPassword_Change()
 mblChange = True
End Sub

Private Sub txtUserName_Change()
 mblChange = True
End Sub

⌨️ 快捷键说明

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