VERSION 5.00
Begin VB.Form frmteachermain 
   Caption         =   "Teacher"
   ClientHeight    =   10740
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   9210
   LinkTopic       =   "Form1"
   ScaleHeight     =   10740
   ScaleWidth      =   9210
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton cmdviewadmin 
      Caption         =   "View Admins"
      Height          =   615
      Left            =   6600
      TabIndex        =   10
      Top             =   5760
      Width           =   2175
   End
   Begin VB.CommandButton cmdviewscores 
      Caption         =   "View Scores"
      Height          =   615
      Left            =   5880
      TabIndex        =   9
      Top             =   4920
      Width           =   2415
   End
   Begin VB.CommandButton cmdsettask 
      Caption         =   "Settask"
      Height          =   495
      Left            =   6480
      TabIndex        =   8
      Top             =   4200
      Width           =   2295
   End
   Begin VB.CommandButton cmdlogout 
      Caption         =   "Logout"
      Height          =   495
      Left            =   6360
      TabIndex        =   7
      Top             =   3360
      Width           =   2295
   End
   Begin VB.CommandButton cmdview 
      Caption         =   "View User"
      Height          =   495
      Left            =   6240
      TabIndex        =   6
      Top             =   2640
      Width           =   2415
   End
   Begin VB.ListBox lstusers 
      Height          =   3960
      ItemData        =   "frmteachermain.frx":0000
      Left            =   600
      List            =   "frmteachermain.frx":0002
      TabIndex        =   5
      Top             =   1080
      Width           =   2775
   End
   Begin VB.CommandButton cmddelete 
      Caption         =   "Delete a user"
      Height          =   495
      Left            =   6240
      TabIndex        =   1
      Top             =   2040
      Width           =   2415
   End
   Begin VB.CommandButton cmdadd 
      Caption         =   "Add a user"
      Height          =   495
      Left            =   6240
      TabIndex        =   0
      Top             =   1320
      Width           =   2415
   End
   Begin VB.Label lbltitletask 
      Caption         =   "Tasks"
      Height          =   495
      Left            =   3720
      TabIndex        =   4
      Top             =   480
      Width           =   2055
   End
   Begin VB.Label lblnametitle 
      Caption         =   "Users"
      Height          =   255
      Left            =   600
      TabIndex        =   3
      Top             =   480
      Width           =   2775
   End
   Begin VB.Label lbltasks 
      BorderStyle     =   1  'Fixed Single
      Height          =   2895
      Left            =   3720
      TabIndex        =   2
      Top             =   1080
      Width           =   2055
   End
End
Attribute VB_Name = "frmteachermain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim myNameArray() As String
Dim myUserArray() As String
Dim myPwdArray() As String


Dim myDifficultArray() As String
Dim myScoreArray() As String
Dim myOutofArray() As String
Dim myName1Array() As String
Dim myStarsArray() As String







'Private Type User_Information
  '  UserName As String
 '   UserID As String
'    Passsword As String
'End Type
'Private myUsers() As User_Information
'Dim myUsers As User_Information


Private Sub cmdadd_Click()
frmnewuser.Show
frmnewuser.txtfullname.SetFocus
Me.Hide
Unload Me
End Sub

'Private Sub LoadUserData()
'Dim strFileContents As String
'Dim strFileRecords() As String
'Dim strThisRecord() As String
'Dim intFile As Integer
'Dim intI As Integer
'intFile = FreeFile



'
' Open and read the entire contents of the file
' File format is assumed to be:
'       Full Name, UserID, Password
' e.g. Fred Jones, Fred, Fredpassword
'
'Open "H:\IPT\project\vb prject2013\names.txt" For Input As intFile
'strFileContents = Input(LOF(intFile), intFile)
'Close intFile
'
' Split the contents into records
' and re-define the UDT array to the number of records in the file
'
'strFileRecords = Split(strFileContents, vbNewLine)
'ReDim myUsers(UBound(strFileRecords))
'
' For each record, split it into the three elements
' and assign to the appriproate members of the UDT
' Add the userID to the ListBox
'\
'For intI = 0 To UBound(strFileRecords)
'    strThisRecord = Split(strFileRecords(intI), ",")
'    myUsers(intI).UserName = strThisRecord(0)
'    myUsers(intI).UserID = strThisRecord(1)
'    myUsers(intI).Passsword = strThisRecord(2)
 '   List1.AddItem (strThisRecord(1))
'Next intI
'For intI = 0 To UBound(strFileRecords)
 '   strThisRecord = Split(strFileRecords(intI), ",")
  '  myUsers(intI).UserName = strThisRecord(0)
  '  myUsers(intI).UserID = strThisRecord(1)
  '  myUsers(intI).Passsword = strThisRecord(2)
 
'    List1.AddItem strThisRecord(1)
'Next intI
'End Sub

Private Sub cmdView_Click()
'
' User has clicked the 'View' button
' Make sure that they have selected a User to view
' (If they haven't then List1.Listindex will be -1)
'
'If List1.ListIndex >= 0 Then
    '
    ' Set the labels on frmviewuser to the corresponding
    ' values associated with the selected User
    ' and Display the Form
    '
 '   With frmviewuser
  '      .lblfullname.Caption = myUsers(List1.ListIndex).UserName
   '     .lblusername.Caption = myUsers(List1.ListIndex).UserID
    '    .lblpassword.Caption = myUsers(List1.ListIndex).Passsword
     '   .Show
    'End With
'Else
 '   MsgBox "Please Select a User Name to View"
'End If
'Label1.Caption = List1.List(List1.ListIndex)
'Label2.Caption = myPwdArray(List1.ListIndex)

frmviewuser.Show
Unload Me
End Sub

Private Sub cmdviewscores_Click()
frmviewscore.Show
Me.Hide
End Sub

Private Sub Form_Load()
Dim intFile As Integer, intfile2 As Integer, x As Integer, y As Integer
Dim myLine As String, displayData As String

intFile = FreeFile
Open "P:\IPT\project\vb prject2013\names.txt" For Input As intFile
    Do While Not EOF(1)
        Line Input #1, myLine
        y = y + 1
       Loop
       ReDim myPwdArray(y) As String
       ReDim myUserArray(y) As String
       
Close #1
intfile2 = FreeFile
Open "P:\IPT\project\vb prject2013\names.txt" For Input As intfile2
    Do While Not EOF(1)
       Line Input #1, myLine
       myLine = Replace(myLine, """", "")
       If Len(Trim(myLine)) > 0 Then
       myNameArray = Split(myLine, ",")
        lstusers.AddItem (myNameArray(0))
        myPwdArray(x) = (myNameArray(2))
        myUserArray(x) = (myNameArray(1))
       End If
       x = x + 1
    Loop

Close #1

Dim intfile3 As Integer, intfile4 As Integer, z As Integer, q As Integer
Dim myLine1 As String, displaydata1 As String


intfile3 = FreeFile
Open "P:\IPT\project\vb prject2013\scores.txt" For Input As intfile3
    Do While Not EOF(1)
    Line Input #1, myLine1
    z = z + 1
    Loop
    ReDim mmyname(z) As String
    ReDim myScoreArray(z) As String
Close #1

intfile4 = FreeFile
Open "P:\IPT\project\vb prject2013\names.txt" For Input As intfile4
    Do While Not EOF(1)
    Line Input #1, myLine1
    myLine1 = Replace(myLine1, """", "")
    If Len(Trim(myLine1)) > 0 Then
    myOutofArray = Split(myLine1, ",")
  
    myName1Array(q) = (myOutofArray(0))
    myScoreArray(q) = (myOutofArray(1))
    myOutofArray(q) = (myOutofArray(2))
    'myDifficultArray(q) = (myOutofArray(3))
    'myStarsArray(q) = (myOutofArray(4))
    End If
    q = q + 1
    Loop
    Close #1
    
    
    
    



End Sub


Private Sub lstusers_Click()
frmviewuser.lblfullname.Caption = lstusers.List(lstusers.ListIndex)
frmviewuser.lblpassword.Caption = myPwdArray(lstusers.ListIndex)
frmviewuser.lblusername.Caption = myUserArray(lstusers.ListIndex)

If myName1Array = lstusers.List(lstusers.ListIndex) Then

lbltasks.Caption = myNameArray

    
    
    
    

End Sub
