At my school we use Visual Basic 6.0 and I wanted to try something that we learned about arrays and using notepad as a cheap database.

We would use thinks like:
Open "Filename.txt" For Input As #1
Input #1, strVARIABLE
lblVARIABLE = str VARIABLE

So basically it'd take the first line from the notepade, read it, and set strVARIABLEs name as that and then the form would display whatever was written there.

I got back home and tried to make a sort of quiz game but I have Visual basic 5.0 and whenever I try to put in Input it says "Input past end of file" but I don't know what that means :l
Any help would be great thanks

It might be good if I actually linked the code :l
I just used google and all the forums are using something different or aren't answered

This is the VB 5.0 project that I'm doing at home [so far]

Private Sub Form_Load()
Dim I As Integer
intLives = 3
intPoints = 0
Open "QuestionOne.txt" For Input As #1
Input #1, strQuestion
For I = 1 To 5
Input #1, strAnswers(I)
Next
End Sub


And this is the VB 6.0 project at school:

Private Sub Form_Load()
cmdReset.Visible = False
cmdPrev.Visible = False
cmdSubmit.Visible = False
Dim I As Integer
Open "BoatrightSurveyData.txt" For Input As #1
Input #1, strTitle
Input #1, strQuestion, intNoofAns
For I = 1 To intNoofAns
Input #1, strAnswer(I)
Next
lblTitle = strTitle
lblQstn = strQuestion
For I = 1 To intNoofAns
optAnswer(I).Visible = True
Next
For I = 1 To 10
optAnswer(I).Caption = strAnswer(I)
Next
End Sub

Input past end of file means that you are trying to read more than the file contains. In help, on the index tab, type in input keyword and select Input # Statement.

Good Luck

use the EOF function
you have an empty line inside your file.

Do While Not EOF(1) -->your file number

your code here...

Loop

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.