Hi there folks! I am working on saving Math data my students are entering, into a textfile so I can view it later. I have 3 listboxes. StudentNameList, StudentAnswerList, StudentMarkList.

Here I am creating a textfile to write into
VB Code:
  1. 'Save the data to a textfile.
  2.  
  3. Dim iFileNo As Integer
  4. iFileNo = FreeFile
  5. 'open the file for writing
  6. Open App.Path & "\Data" & "Grade " & GradeLBL.Caption & " SavedData" & "-" & DateLBL.Caption & ".txt" For Output As #iFileNo
  7. 'please note, if this file already exists it will be overwritten!
  8.  
  9.  
  10.  
  11. 'close the file (if you dont do this, you wont be able to open it again!)
  12. Close #iFileNo

After the file is made and open, I would like to loop through the lists, and for each list index ( like StudentNameList(0), StudentAnswerList(0), and StudentMarkList(0). I would like to save to the same line of the textfile. Then go to the next index of the lists, (1), and so on.

Would anyone here know a trick for doing that?

Thanks a lot!