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

📄 frmlogin1.frm

📁 This project is to design the automated system for the inventory of Al-Ahmad Cotton and Oil Mills si
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmLogin1 
   BackColor       =   &H80000013&
   Caption         =   "Login"
   ClientHeight    =   4200
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   5475
   LinkTopic       =   "Form43"
   ScaleHeight     =   4200
   ScaleWidth      =   5475
   StartUpPosition =   3  'Windows Default
   Begin VB.Frame Frame1 
      BackColor       =   &H80000013&
      Height          =   2055
      Left            =   360
      TabIndex        =   3
      Top             =   960
      Width           =   4695
      Begin VB.TextBox TxtPassword 
         Height          =   330
         IMEMode         =   3  'DISABLE
         Left            =   1935
         PasswordChar    =   "*"
         TabIndex        =   6
         Top             =   885
         Width           =   2430
      End
      Begin VB.ComboBox Cmbusertype 
         Height          =   315
         ItemData        =   "frmLogin1.frx":0000
         Left            =   1950
         List            =   "frmLogin1.frx":000A
         TabIndex        =   5
         Top             =   1410
         Width           =   2415
      End
      Begin VB.TextBox TexUserID 
         Height          =   330
         Left            =   1935
         TabIndex        =   4
         Top             =   360
         Width           =   2430
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "Password  "
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   11.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000006&
         Height          =   270
         Left            =   360
         TabIndex        =   9
         Top             =   885
         Width           =   1155
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "User Type "
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   11.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000006&
         Height          =   270
         Left            =   360
         TabIndex        =   8
         Top             =   1410
         Width           =   1155
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "User ID     "
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   11.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000006&
         Height          =   270
         Left            =   360
         TabIndex        =   7
         Top             =   360
         Width           =   1095
      End
   End
   Begin VB.Frame Frame2 
      BackColor       =   &H80000013&
      Height          =   735
      Left            =   1560
      TabIndex        =   0
      Top             =   3240
      Width           =   2535
      Begin VB.CommandButton BtnCancel 
         Appearance      =   0  'Flat
         BackColor       =   &H80000009&
         Caption         =   "&Cancel"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   9
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   450
         Left            =   1200
         MaskColor       =   &H00FFFFFF&
         Style           =   1  'Graphical
         TabIndex        =   2
         Top             =   240
         Width           =   1125
      End
      Begin VB.CommandButton BtnLogin 
         Appearance      =   0  'Flat
         BackColor       =   &H80000009&
         Caption         =   "&Login ..."
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   9
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   450
         Left            =   120
         MaskColor       =   &H00FFFFFF&
         Style           =   1  'Graphical
         TabIndex        =   1
         Top             =   240
         Width           =   1095
      End
   End
   Begin VB.Image Image1 
      Height          =   960
      Left            =   0
      Picture         =   "frmLogin1.frx":001F
      Top             =   0
      Width           =   5460
   End
End
Attribute VB_Name = "frmLogin1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs As ADODB.Recordset
Dim RsLogin As ADODB.Recordset
Dim cnn As ADODB.Connection
Dim rs1 As ADODB.Recordset
Option Explicit

Private Sub BtnCancel_Click()
  VUserId = ""
   VUsertype = ""
   Login = False
 End
End Sub
Private Sub BtnLogin_Click()
If TexUserID.Text = "" Then
MsgBox "Enter ID"
TexUserID.SetFocus
Exit Sub
End If
If Cmbusertype.Text = "" Then
MsgBox "Select user type"
Cmbusertype.SetFocus
Exit Sub
End If
If TxtPassword.Text = "" Then
MsgBox "Enter password"
TxtPassword.SetFocus
Exit Sub
End If
'**********************
If Cmbusertype.Text = "Operator" Then
'///////////////////
Form15.update.Enabled = False
Form20.update.Enabled = False
MDIForm1.deleteuser.Visible = False
MDIForm1.addnewuser.Visible = False
MDIForm1.qq.Visible = False
MDIForm1.ww.Visible = False
Form25.update.Enabled = False
Form25.delete.Enabled = False
Form28.update.Enabled = False
Form28.delete.Enabled = False
Form10.update.Enabled = False
Form10.delete.Enabled = False
Form12.update.Enabled = False
Form12.delete.Enabled = False
Form9.delete.Enabled = False
form3.delete.Enabled = False
Form29.update.Enabled = False
Form29.delete.Enabled = False
Form5.update.Enabled = False
Form5.delete.Enabled = False

Else

Form15.update.Enabled = True
Form20.update.Enabled = True
MDIForm1.addnewuser.Visible = True
MDIForm1.deleteuser.Visible = True
MDIForm1.qq.Visible = True
MDIForm1.ww.Visible = True
Form25.update.Enabled = True
Form25.delete.Enabled = True
Form28.update.Enabled = True
Form28.delete.Enabled = True
Form10.update.Enabled = True
Form10.delete.Enabled = True
Form12.update.Enabled = True
Form12.delete.Enabled = True
Form9.delete.Enabled = True
form3.delete.Enabled = True
Form29.update.Enabled = True
Form29.delete.Enabled = True
Form5.update.Enabled = True
Form5.delete.Enabled = True

End If
'***********************

Set rs = New ADODB.Recordset
    Dim RsLogin As New ADODB.Recordset
If rs.State = adStateOpen Then rs.Close
  rs.Open "Login", cnn, adOpenStatic, adLockReadOnly, adCmdTable
   If rs.RecordCount = 0 Then
 If MsgBox("WELCOME PLZ First Create Account   " & rs.RecordCount) = vbOK Then
 
   'frmLogin.Visible = False
 ' newuser.Show
 
 Exit Sub
 End If
 End If
    If RsLogin.State = adStateOpen Then RsLogin.Close
    RsLogin.Open "select * from Login where UserId = '" & (TexUserID.Text) & "'", cnn, adOpenStatic, adLockReadOnly
   If RsLogin.RecordCount = 0 Then
        MsgBox "Invalid User Login ID.", vbExclamation + vbOKOnly, "Alert"
        TexUserID.SetFocus
        RsLogin.Close
        Exit Sub
    ElseIf RsLogin.RecordCount > 0 And Trim(RsLogin!UserPassword) <> Trim(TxtPassword.Text) Then
        MsgBox "Invalid User Login Password.", vbExclamation + vbOKOnly, "Alert"
        TxtPassword.SetFocus
        RsLogin.Close
        Exit Sub
    ElseIf RsLogin.RecordCount > 0 And Trim(RsLogin!UserType) <> Trim(Cmbusertype.Text) Then
        MsgBox "Invalid User Login Type.", vbExclamation + vbOKOnly, "Alert"
        Cmbusertype.SetFocus
        RsLogin.Close
        Exit Sub
    ElseIf (RsLogin.RecordCount > 0) And Trim(RsLogin!UserPassword) = Trim(TxtPassword.Text) And Trim(RsLogin!UserType) = Trim(Cmbusertype.Text) Then
        VUsertype = RsLogin!UserType
        VUserId = RsLogin!UserID
      Login = True
        MsgBox TexUserID.Text & " has been successfully login.", vbInformation + vbOKOnly, "Confirmation"
      RsLogin.Close
        
        Unload Me
        MDIForm1.Show
        MDIForm1.Enabled = True
 
 '*****************
        
    End If
    Exit Sub
    
End Sub

Private Sub Cmbusertype_GotFocus()
'employeeinfo.cmddel.Enabled = False
End Sub

Private Sub Cmbusertype_KeyPress(KeyAscii As Integer)


KeyAscii = 0
End Sub

Private Sub Form_Load()
Set cnn = New ADODB.Connection
cnn.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=hussain"
End Sub

Private Sub TxtPassword_KeyPress(KeyAscii As Integer)
If (TexUserID.Text <> "" And TxtPassword.Text <> "") And (KeyAscii = 13 And Cmbusertype.Text <> "") Then
    Call BtnLogin_Click
ElseIf TxtPassword.Text <> "" And KeyAscii = 13 Then
    Cmbusertype.SetFocus
End If
End Sub

Private Sub TexUserid_KeyPress(KeyAscii As Integer)
If Not ((KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8) Then
KeyAscii = 0
End If
If KeyAscii = 13 Then
TexUserID.SetFocus
End If
End Sub



⌨️ 快捷键说明

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