Vb Coding Trouble


Status
Not open for further replies.

deadlychicken22

Man is a reasoning rather than a reasonable animal
Joined
Mar 18, 2004
Messages
1,501
Location
MN, USA
Website
Visit site
I am creating a program in Visual Basic and have run into a problem. I am trying to load text from a file into variables (one variable for each line of text) and am trying to use a variable array for this. However, the size of text file has a large range so I was thinking of using something like this to find the end of the text file:
Code:
endfile=0
Open App.Path & "\test.txt" For Input As #1
Do While Not EOF(1)
    Line Input #1, tempInput
    endFile = endFile + 1
    Loop
Close #1
Then I tried to create a variable array to be used to store the text file line by line, making the variable array go from 0 to endfile, however, visual basic didn't like this because endfile is a variable and it wants a constant. How can I create a variable array that ranges from 0 to the end of the text file with varying sizes of text files?
 
Status
Not open for further replies.
Back
Top