Work with collections in VB.NET
This article helps you to understanding the working of Collection Class.
Collection is an object that can hold one or more object like to it consists of all of the controls objects on the form. It do not have a fixed size, the size of a collection is adjusted whenever an item is added or deleted. You can store any type of object in a collection. One of the limitation of collection is that you can not update an items in a collection.
To explain the use of Collection class, First create a new collection object called Name List, and than add 4 name titles to the collection, now to access each item in a collection you have to use For each Loop.
The common properties and methods of the collection class is:
Property's: Count and Item(index)
Methods: Add(object) and Remove(index)
Dim NameList As New Collection
Dim sMessage As String
Dim sNameList As String
For Each sNameList In NameList
sMessage &= sNameList & ControlChars.CrLf
MessageBox.Show(sMessage, "NameList Collection")
I hope this article helps you to understand the working or use of collection class which is the basic class for creating and using collections.