Hello there. I have had the chance to try out some really neat software at school that helps with students morning routines, such as signing in/attendance, etc. The program will load up a student roster, and basically the students drag a picturebox with their name to the sign in box.
After they all sign in, I give the option to save the attendance list to the computer in a .txt file using this code.
As you can see, the class name goes in Attendance.ClassName.Text, so when the program saves, you would end up with a txt file named something like AttendanceList- CLASSNAME_February 3 2013.txt
That is printed in the immediate at the bottom of my vb 6 screen
The actual textfile is created, but is empty with 0KB, I am getting an error saying Bad File Mode, and it will highlight the line Print #1, Attendance.ClassName.Text
Would anyone know what bad file mode means? It obviously uses the textbox because the actual file includes the text from the textbox, so I am at a loss here? :) Your help is always appreciated!!
After they all sign in, I give the option to save the attendance list to the computer in a .txt file using this code.
VB Code:
Dim arrFileName() As String Dim i As Integer Dim ii As Integer Dim sFileText As String Dim myFile As String Dim iFileNo As Integer iFileNo = FreeFile myFile = App.Path & "\AttendanceLists\AttendanceList" & "- " & ClassName.Text & "_" & MonthNames.Caption & " " & DayNum.Caption & " " & Year(Now) & ".txt" Debug.Print myFile arrFileName = Split(myFile, "\") Attendance.TXTFileName.Text = arrFileName(UBound(arrFileName)) 'the output EnglishMonths(4) look something like this: 'the actual usage: Open myFile For Output As #iFileNo Print #1, Attendance.ClassName.Text Print #1, "Absent Students Today" Print #1, "" For i = 0 To AbsentList.ListCount - 1 Print #1, AbsentList.List(i) Next i Print #1, "" Print #1, "Present Students Today" Print #1, "" For ii = 0 To PresentList.ListCount - 1 Print #1, PresentList.List(ii) Next ii Print #1, "" Close #1
As you can see, the class name goes in Attendance.ClassName.Text, so when the program saves, you would end up with a txt file named something like AttendanceList- CLASSNAME_February 3 2013.txt
That is printed in the immediate at the bottom of my vb 6 screen
The actual textfile is created, but is empty with 0KB, I am getting an error saying Bad File Mode, and it will highlight the line Print #1, Attendance.ClassName.Text
Would anyone know what bad file mode means? It obviously uses the textbox because the actual file includes the text from the textbox, so I am at a loss here? :) Your help is always appreciated!!