The Item method retrieves an object from a collection.
[Set object =] collection.Item(Index)
Part | Description |
---|---|
object | Object to be retrieved from collection |
collection | Expression that evaluates to an collection in the Applies To list |
Index | Object name or ordinal position |
Index is the object name or the numeric position within the collection.
The required type of Object depends on the collection from which it is being retrieved.
Collection | Object |
---|---|
Columns | Column Object |
Connections | Connection Object Connection2 Object |
DTSMQMessages | DTSMQMessage Object |
DynamicPropertiesTaskAssignments | DynamicPropertiesTaskAssignment Object |
GlobalVariables | GlobalVariable Object |
Lookups | Lookup Object |
OLEDBProperties | OLEDBProperty Object |
OLEDBProviderInfos | OLEDBProviderInfo Object |
PrecedenceConstraints | PrecedenceConstraint Object |
Properties | Property Object |
SavedPackageInfos | SavedPackageInfo Object |
ScriptingLanguageInfos | ScriptingLanguageInfo Object |
Steps | Step Object Step2 Object |
TaskInfos | TaskInfo Object |
Tasks | Task Object |
TransformationInfos | TransformationInfo Object |
Transformations | Transformation Object Transformation2 Object |
TransformationSets | TransformationSet Object |
You can iterate through these collection using the Item method and Count property. In Microsoft® Visual Basic® this looks like:
For Index = 1 To collection.Count
Set object = collection.Item(Index)
. . .
Next Index
However, it is faster to iterate through these collections using For Each ... Next in Visual Basic:
For Each object In collection
. . .
Next object
HRESULT Item(
VARIANT Index,
interface **pRetVal);