I have a text file that I load line by line into a listbox, I would like to load it in reverse from the last line to the first line into the listbox, is this possible? This is on Windows. Thanks.
—t = f.OpenAsTextFile // open selected text file
—While Not t.EndOfFile
— x = t.ReadLine
— lstHistory.AddRow(x)
—Wend
—t.Close
Did you try to insert a Row at 0 instead of add a Row one after the previous… ?
No I didn’t, thanks for the suggestion, I’ll give it a try.
You can also do this, which might be faster:
var contents as string = t.ReadAll
t.Close
contents = contents.ReplaceLineEndings( &uA )
var lines() as string = contents.Split( &uA )
for index as integer = lines.LastIndex downto 0
lstHistory.AddRow( lines( index ) )
next
This is the difference in the “Automatic mode” and the “Thinking first mode” !
Nice advice Kem !