Results 1 to 3 of 3

Thread: [RESOLVED] Is an array list a control array?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2006
    Posts
    108

    Resolved [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?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Is an array list a control array?

    Quote 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.
    Quote 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.
    Quote 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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2006
    Posts
    108

    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
  •  



Click Here to Expand Forum to Full Width