devxlogo

Creating Huge Arrays with ReDim Keyword

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

See also  Professionalism Starts in Your Inbox: Keys to Presenting Your Best Self in Email
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist