Creating Huge Arrays with ReDim Keyword

Question:
I am loading a file which is basically a list of numbers into an array. The array is declared as a string. I keep getting an “out of string space” error when the file is larger than about 40K bytes or 3000 lines. The ReDim statement says it can handle HUGE arrays, but is there a Visual Basic limit for the size of an array? How would you handle a situation where the size of the file is larger than the largest size for an array?

Answer:
You need to add a string length to the ReDim statement for it to allow you to use ahuge array. You have to say this statement like this:

ReDim Preserve InPutFile(Count) as String * 40

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: