you know... you could use the filesystem object in that FOR loop and eliminate the split function (although it's fun to use). do this...
(after dimming and setting, of course)
do until fso.atendofstream MSHFlexGrid1.AddItem fso.readline Next i love the fso... and while that method will be reading and accessing the text file every time it loops (causing a slight performance issue), you will not have to load your memory up with 100,000 lines of text. but... question... maybe i am saying all this for naught.. cuz i think you would still have a memory issue even with the listbox containing that much data. at least this method will cut that memory usage in half (ie, won't have a full array and a full listbox). if the performance is too slow to justify using that method on account of only a few large files every once in awhile, trap the memory error number and use an IF statement that says If Err.Number = 40 Then *code to run above FSO loop. that way it will be off to the bat loop as a backup. hey... you know, or go buy a gig stick.
|