Highlights
All Snippets
Top 100 Snippets
Librarians
gbCodeLib

By Language
VB6
JavaScript
Perl
HTML
SQL
Java
DOS

GBIC >> Source Code >> Visual Basic >> Snippet

Read text file into an array #2


'puts content into array starting at position zero
'if you know the number of lines in advance, you won't have to use REDIM Preserve
Dim temp As String , MyArray As Variant
Open "filename.txt" For Input As #1
While Not EOF(1)
    Redim Preserve MyArray(i)
   Line Input #1, MyArray(i)
   i = i + 1
Wend
Close