Previous in Contents Next in Contents

The SimpleList Object

The SimpleList object consists of an array of Variants that supports enumeration.

The SimpleList object supports the following property.

Property Description
Count Read-only number that identifies the number of elements in the SimpleList object.

The SimpleList object supports the following methods.

Method Description
Add Adds the specified item to the list.
Delete Deletes an item based upon a specified index value.

To create a SimpleList object, use the Active Server Pages (ASP) Server object's CreateObject method, as follows:

Set listColors = Server.CreateObject("Commerce.SimpleList")

After creating a SimpleList object, you can use the SimpleList's Add and Delete methods to add and remove items from the underlying list:

Call listColors.Add("Red")
Call listColors.Add("Green")
Call listColors.Add("Blue")

To retrieve elements, you can index into the list, as you would index into an array. The index is specified relative to zero (0):

Response.Write listColors(1)

Or you can use the Microsoft® Visual Basic® Scripting Edition For Each statement to iterate through the contents of the SimpleList object:

For each color in listColors
   Response.Write color & "<br>"
next

Related Topics


© 1997-2000 Microsoft Corporation. All rights reserved.