VERSION 5.00
Begin VB.Form frmAddUser 
   BorderStyle     =   4  'Fixed ToolWindow
   Caption         =   "Form1"
   ClientHeight    =   2160
   ClientLeft      =   45
   ClientTop       =   270
   ClientWidth     =   5010
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2160
   ScaleWidth      =   5010
   ShowInTaskbar   =   0   'False
   StartUpPosition =   1  'CenterOwner
   Tag             =   "3000"
   Begin VB.ComboBox cmbLevel 
      BackColor       =   &H00FFFFFF&
      Height          =   315
      ItemData        =   "frmUser.frx":0000
      Left            =   2310
      List            =   "frmUser.frx":000A
      Style           =   2  'Dropdown List
      TabIndex        =   2
      Top             =   420
      Width           =   1635
   End
   Begin VB.TextBox txtPassword 
      Height          =   315
      Left            =   2310
      MaxLength       =   10
      TabIndex        =   3
      Top             =   780
      Width           =   1635
   End
   Begin VB.CommandButton cmdUser 
      Caption         =   "OK"
      Enabled         =   0   'False
      Height          =   345
      Index           =   0
      Left            =   2670
      TabIndex        =   5
      Tag             =   "100"
      Top             =   1710
      Width           =   1065
   End
   Begin VB.CommandButton cmdUser 
      Caption         =   "Cancel"
      Height          =   345
      Index           =   1
      Left            =   3810
      TabIndex        =   6
      Tag             =   "102"
      Top             =   1710
      Width           =   1065
   End
   Begin VB.TextBox txtUserID 
      Height          =   315
      Left            =   2310
      Locked          =   -1  'True
      TabIndex        =   1
      Top             =   90
      Width           =   1635
   End
   Begin VB.TextBox txtUserName 
      Height          =   315
      Left            =   2310
      MaxLength       =   24
      TabIndex        =   4
      Top             =   1110
      Width           =   2595
   End
   Begin VB.CommandButton cmdQueryID 
      Caption         =   "Query ID"
      Height          =   315
      Left            =   3990
      TabIndex        =   0
      Tag             =   "2007"
      Top             =   90
      Width           =   945
   End
   Begin VB.Label labAddUser 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFFF&
      BackStyle       =   0  'Transparent
      Caption         =   "Control Lvel "
      BeginProperty Font 
         Name            =   "Fixedsys"
         Size            =   12
         Charset         =   136
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Index           =   1
      Left            =   900
      TabIndex        =   10
      Tag             =   "3012"
      Top             =   510
      Width           =   1335
   End
   Begin VB.Label labAddUser 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFFF&
      BackStyle       =   0  'Transparent
      Caption         =   "Password "
      BeginProperty Font 
         Name            =   "Fixedsys"
         Size            =   12
         Charset         =   136
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Index           =   3
      Left            =   900
      TabIndex        =   9
      Tag             =   "3014"
      Top             =   810
      Width           =   1335
   End
   Begin VB.Line Line1 
      BorderColor     =   &H00808080&
      BorderWidth     =   2
      Index           =   0
      X1              =   -30
      X2              =   5010
      Y1              =   1620
      Y2              =   1620
   End
   Begin VB.Label labAddUser 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFFF&
      BackStyle       =   0  'Transparent
      Caption         =   "Card ID "
      BeginProperty Font 
         Name            =   "Fixedsys"
         Size            =   12
         Charset         =   136
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Index           =   0
      Left            =   900
      TabIndex        =   8
      Tag             =   "3011"
      Top             =   120
      Width           =   1335
   End
   Begin VB.Label labAddUser 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFFFFF&
      BackStyle       =   0  'Transparent
      Caption         =   "User Name "
      BeginProperty Font 
         Name            =   "Fixedsys"
         Size            =   12
         Charset         =   136
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Index           =   2
      Left            =   900
      TabIndex        =   7
      Tag             =   "3013"
      Top             =   1140
      Width           =   1335
   End
   Begin VB.Image Image1 
      Height          =   720
      Left            =   60
      Picture         =   "frmUser.frx":0029
      Top             =   60
      Width           =   720
   End
End
Attribute VB_Name = "frmAddUser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Public UserIndex As Integer

Private Sub cmdQueryID_Click()
    frmMain.txtFocus = 2
    frmMain.PCR300x.Request
End Sub

Private Sub cmdUser_Click(index As Integer)
    Dim i As Integer
    'On Error Resume Next
    Select Case index
        Case 0
            If SaveUserDB Then
                UserDB(UserIndex).CardID = txtUserID.Text
                UserDB(UserIndex).Password = txtPassword.Text
                UserDB(UserIndex).Level = cmbLevel.ListIndex
                UserDB(UserIndex).Name = txtUserName.Text
                UserDB(UserIndex).Enable = True
            End If
        Case 1
    End Select
    Unload Me
End Sub



Private Sub Form_Load()
    LoadResStrings Me
    
    cmbLevel.Clear
    cmbLevel.AddItem LoadResStringX(3021, "Administrator")
    cmbLevel.AddItem LoadResStringX(3022, "Local User")

    If UserIndex <= UBound(UserDB) Then
        txtUserID.Text = DeSpace(UserDB(UserIndex).CardID)
        txtPassword.Text = DeSpace(UserDB(UserIndex).Password)
        txtUserName.Text = UserDB(UserIndex).Name
        cmbLevel.ListIndex = UserDB(UserIndex).Level
    End If
End Sub


Private Sub cmbLevel_Click()
    If cmbLevel.ListIndex > 0 Then
        txtPassword.Enabled = False
        txtPassword.BackColor = RGB(&HC0, &HC0, &HC0)
    Else
        txtPassword.Enabled = True
        txtPassword.BackColor = RGB(255, 255, 255)
    End If
End Sub

Private Sub txtUserName_Change()
    If txtUserID.Text <> "" And txtUserName.Text <> "" Then
        cmdUser(0).Enabled = True
    Else
        cmdUser(0).Enabled = False
    End If

End Sub

