A collection helps to centralize the management of its member objects. All NetShow Theater Server collection objects are zero-based arrays of like types of objects. All collection objects expose the Count property, which specifies the number of objects contained in the collection, and the Item property, which specifies individual objects in the collection.
To access the properties and methods of objects in a collection, reference the name of the collection object, by using a numeric argument specifying the position of the object in the array. For example, you can use the following syntax to access the Name property of a Client object:
<MediaServer Object>.<Collection Name>[.Item](Index).<Property Name>
The Item property is the default property of each collection object. Explicit use of it to reference a member object is optional. For example, you can write the following code to display the IPAddress property of each Client object in a Clients collection object:
Dim clients as IMSrvClients
Set clients = MediaServer1.Clients
For i=0 to clients.Count-1
MsgBox (Clients(i).IPAddress)
Next
However, with Visual Basic, you can make the implementation more efficient by using the For Each … In … loop statement:
Dim client As IMSrvClient
For Each client In MediaServer1.Clients
MsgBox (Client.IPAddress)
Next
[Previous][Next]