Hello there everyone!
I am working on a prog to help track student behavior. I have a textfile with the student names, and an array of label captions I am trying to load them into. It is from an earlier project where in that older project I needed to start at index 1, but this time I need to start at index 0, but am not sure what to change.
Basically I want it to start at 0, then load for index 1,2,3,etc.
Here is the modified code.
I am pretty sure it has something to do with iCount = iCount + 1, but I need it to to increase, so it will load 1 line of the text file to StudentNameLBL(0). then the next line to StudentNameLBL(1), etc.
Can anyone tell me what I have to change to start at 0?
Thanks!
I am working on a prog to help track student behavior. I have a textfile with the student names, and an array of label captions I am trying to load them into. It is from an earlier project where in that older project I needed to start at index 1, but this time I need to start at index 0, but am not sure what to change.
Basically I want it to start at 0, then load for index 1,2,3,etc.
Here is the modified code.
VB Code:
' THIS CODE LOADS The Students Names TO the Label Captions Dim sFileText As String Dim iFileNo As Integer Dim iCount As Integer iFileNo = FreeFile 'open the file for reading Open App.Path & "\StudentRosters\Roster1\Roster1.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) iCount = iCount + 1 Input #iFileNo, sFileText 'show the text (you will probably want to replace this line as appropriate to your program!) TrafficLights.StudentNameLBL(iCount).Caption = sFileText Loop 'close the file (if you dont do this, you wont be able to open it again!) Close #iFileNo
I am pretty sure it has something to do with iCount = iCount + 1, but I need it to to increase, so it will load 1 line of the text file to StudentNameLBL(0). then the next line to StudentNameLBL(1), etc.
Can anyone tell me what I have to change to start at 0?
Thanks!