|
-
Jun 24th, 2006, 12:05 AM
#1
Thread Starter
Lively Member
[RESOLVED] Is an array list a control array?
Hi,
I have read that an array list stores objects. So, if an application creates Picturebox control objects at run time, can they be stored in an array list at run time?
Is an array list an array of objects or a linked list of objects?
Also, how do I pass the array list to a public sub as an argument?
-
Jun 24th, 2006, 12:33 AM
#2
Re: Is an array list a control array?
 Originally Posted by LiLo
Hi,
I have read that an array list stores objects. So, if an application creates Picturebox control objects at run time, can they be stored in an array list at run time?
Yes they can. A PictureBox is an object so of course it can be stored in a list of objects.
 Originally Posted by LiLo
Is an array list an array of objects or a linked list of objects?
It is neither directly. An ArrayList is a collection that internally maintains an Object array, hence it being able to store any type of object. The convenience of the ArrayList comes from the fact that it handles the reallocation of memory required if an when the array needs to be resized.
 Originally Posted by LiLo
Also, how do I pass the array list to a public sub as an argument?
An ArrayList is an object like any other. How do you pass a String to a method? You declare the method with a String argument and then you call it and pass a String object. How would you then pass an ArrayList to a method?
An ArrayList is NOT a control array in the VB6 sense as they do not exist in VB.NET. It is not even an array of controls. It is a collection of objects. The main drawback of the ArrayList is that it can hold any type of object, so you cannot enforce a specific type on the items. In .NET 1.x you can create your own strongly-typed collections by inheriting the CollectionBase class. In .NET 2.0 you simply declare a List(Of T) variable. .NET 2.0 also has LinkedList collections. Please specify your version in future. Just clcik the appropriate radio button when creating a thread.
-
Jun 25th, 2006, 07:58 AM
#3
Thread Starter
Lively Member
Re: Is an array list a control array?
Hi, ok.......thx for the detailed explanations!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|