?
Solved

Using COLLECTIONS save memory over Arrays?!?

Posted on 1999-01-20
3
Medium Priority
?
138 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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
Course of the Month14 days, 16 hours left to enroll

771 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