[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Using COLLECTIONS save memory over Arrays?!?

Posted on 1999-01-20
3
Medium Priority
?
139 Views
Last Modified: 2010-05-03
I am interested in making several (ie 50) instances of my form which has several controls on it. Is it best to use a Collection or to use an Array instance. I know many of you will say use a Collection instead BUT does it save any more memory than Arrays?  I was playing around and i notice 0 difference in memory savings...so what is the benefit of using Collections over arrays when it comes to having instances of Forms?

Thanks
0
Comment
Question by:ljaques
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 2

Accepted Solution

by:
VBDesigns earned 0 total points
ID: 1469750
Collections are slower and (I believe) use more memory than arrays.  However, collections allow easy management of data.  Computers are fast enough now a days that collections will do just fine for most data management -- you'll only want to use arrays with speed-specific code that requires instant access to array data.

The advantage to collections is that you can regulate multiple types of objects and variables with them -- Arrays only allow one data type.

Collections also support indexing, and instant 'cleanup' when you remove items from them -- with an array, you need to move the data yourself.

Good luck!
0
 

Author Comment

by:ljaques
ID: 1469751
Thanks very much for that CLEAR answer!
0
 
LVL 1

Expert Comment

by:mogray
ID: 1469752
There is also a nice article on this in last month's VBPJ (visual basic programmer's journal).  The article includes some performance tests and arrays are indeed faster, but as VBDesigns has said, arrays require more bookkeeping on your part.

Regards,
Wayne
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question