VERSION 5.00
Begin VB.Form frmLogin 
   Caption         =   ". . : :  L O G I N  : : . ."
   ClientHeight    =   2415
   ClientLeft      =   5835
   ClientTop       =   4290
   ClientWidth     =   4080
   ControlBox      =   0   'False
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   ScaleHeight     =   2415
   ScaleWidth      =   4080
   ShowInTaskbar   =   0   'False
   Begin VB.CommandButton cmdLoginCancel 
      Height          =   975
      Left            =   3120
      Picture         =   "frmLogin.frx":0000
      Style           =   1  'Graphical
      TabIndex        =   5
      Top             =   1320
      Width           =   855
   End
   Begin VB.CommandButton cmdLogin 
      Height          =   975
      Left            =   1800
      Picture         =   "frmLogin.frx":45D2
      Style           =   1  'Graphical
      TabIndex        =   4
      Top             =   1320
      Width           =   855
   End
   Begin VB.TextBox txtLoginPass 
      Height          =   375
      IMEMode         =   3  'DISABLE
      Left            =   1800
      PasswordChar    =   "*"
      TabIndex        =   1
      Top             =   720
      Width           =   2175
   End
   Begin VB.TextBox txtLoginNama 
      Height          =   375
      Left            =   1800
      TabIndex        =   0
      Top             =   120
      Width           =   2175
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "PASSWORD"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   300
      Left            =   120
      TabIndex        =   3
      Top             =   720
      Width           =   1545
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "NAMA"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   300
      Left            =   120
      TabIndex        =   2
      Top             =   120
      Width           =   765
   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 cepat As Long

Dim oldsize As Long
   
Private Sub Form_Load()
    CenterC Me
    oldsize = Me.Width
End Sub

Private Sub Form_Resize()
    If Me.Width = oldsize Then
        Exit Sub
    Else
        CenterC Me
        oldsize = Me.Width
    End If
    If Me.Width <> 4200 Then Me.Width = 4200
    If Me.Height <> 2925 Then Me.Height = 2925
End Sub


Sub hilang()
cepat = 1000
    ' // Hilang Ke Samping Kanan
        While Left + Width < Screen.Width
            DoEvents
            Left = Left + cepat
        Wend
    ' // Hilang Ke Bawah
        While Top - Height < Screen.Height
            DoEvents
            Top = Top + cepat
        Wend
    Unload Me
End Sub

Private Sub cmdLoginCancel_Click()
    hilang
End Sub

Private Sub cmdLogin_Click()
    If rec.State = 1 Then rec.Close
        rec.Open "select * from T_User where user= '" & txtLoginNama & "' And Password = '" & txtLoginPass & "'", conn, 3, 3
            If Not rec.EOF Then
                    If rec!Tipe = "Administrator" Then
                        With MdiMenuUtama
                            .mnLogOut.Enabled = True
                            .mnLogin.Enabled = False
                            .mnTransaksi.Enabled = True
                            .mnDaftarFilm.Enabled = True
                            .mnAnggota.Enabled = True
                            .mnLaporan.Enabled = True
                            .mnPetugas.Enabled = True
                            .mnGame.Enabled = True
                            .StatusBar.Panels(2) = txtLoginNama
                        End With
                        hilang
                    Else
                        With MdiMenuUtama
                            .mnLogOut.Enabled = True
                            .mnLogin.Enabled = False
                            .mnTransaksi.Enabled = True
                            .mnAnggota.Enabled = True
                            .mnLaporan.Enabled = True
                            .mnGame.Enabled = True
                            .StatusBar.Panels(2) = txtLoginNama
                        End With
                        hilang
                    End If
            Else
                MsgBox "Data Salah", vbCritical, "L O G I N"
                txtLoginNama = ""
                txtLoginPass = ""
                txtLoginNama.SetFocus
            End If
End Sub

Private Sub txtLoginNama_KeyPress(KeyAscii As Integer)
    If KeyAscii = vbKeyReturn Then
        SendKeys ("{TAB}")
        KeyAscii = 0
    End If
End Sub

Private Sub txtLoginPass_KeyPress(KeyAscii As Integer)
    If KeyAscii = vbKeyReturn Then
        cmdLogin.Value = True
    End If
End Sub
