Hi there! I am working on a newer version of an attendance program for students to log into when they arrive in the morning. The kids love it, but there have been requests by teachers to allow it to store more than 1 roster of students.
Right now each students name is in its own textfile, such as Student1.txt student2.txt, etc.
What I would like to do is keep all of the students in a specific txt file called Roster1.text. This textfile will keep all of the students for one class in a single file for easier access.
The problem is, I am not sure how to load the textfile so say Line1 of the Roster1.txt would go to a label caption called StudentName1LBL.caption
The label captions are on the screen so the student clicks on them and logon,
The code I use now, loads all of a textfile to a label caption, like this...
I was wondering if anyone would know of a way to alter this code so if I wanted to load student 30, it would load line 30 out of a Roster1.txt file? Thanks so much!
Right now each students name is in its own textfile, such as Student1.txt student2.txt, etc.
What I would like to do is keep all of the students in a specific txt file called Roster1.text. This textfile will keep all of the students for one class in a single file for easier access.
The problem is, I am not sure how to load the textfile so say Line1 of the Roster1.txt would go to a label caption called StudentName1LBL.caption
The label captions are on the screen so the student clicks on them and logon,
The code I use now, loads all of a textfile to a label caption, like this...
VB Code:
' THIS CODE LOADS STUDENT#30 Dim sFileText As String Dim iFileNo As Integer iFileNo = FreeFile 'open the file for reading Open App.Path & "\Student30.txt" For Input As #iFileNo 'change this filename to an existing file! (or run the example below first) 'read the file until we reach the end Do While Not EOF(iFileNo) Input #iFileNo, sFileText 'show the text (you will probably want to replace this line as appropriate to your program!) Attendance.StudentNameLBL30.Caption = sFileText Loop 'close the file (if you dont do this, you wont be able to open it again!) Close #iFileNo
I was wondering if anyone would know of a way to alter this code so if I wanted to load student 30, it would load line 30 out of a Roster1.txt file? Thanks so much!