Add (States)


Description

Add a new state to a States collection.

Syntax

someStates.Add(Name, indexBefore, indexAfter)

 

Parameter Description
someStates a States collection
Name Optional. A string specifying a name for the new State object. If no string or the empty string is given, a new name is generated.
indexBefore Optional. An integer, or a string, or a State object specifying where the new State object is to be created. The new State object will be positioned before the specified State object. The zero-based integer is a index into the States collection. Likewise, the State object must be in the States collection and the string must be the name of a State object in the States collection.
indexAfter Optional. An integer, or a string, or a State object specifying where the new State object is to be created. The new State object will be positioned after the specified State object. The zero-based integer is a index into the States collection. Likewise, the State object must be in the States collection and the string must be the name of a State object in the States collection.

 

Either indexBefore or indexAfter may be given, but not both. If neither is given, the new State object is created at the end of the States collection.

Remarks

If indexBefore is numeric, it may have a value from 0 to someStates.Count (inclusive). If its value is 0, the item will be added at the beginning of the collection. If its value is someStates.Count, the item will be added at the end of the collection.

If indexAfter is numeric, it may have a value from -1 to someStates.Count - 1 (inclusive). If its value is -1, the item will be added at the beginning of the collection. If its value is someStates.Count -1, the item will be added at the end of the collection.

Return Value

The new State object.

Applies To

States