NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

EventDescriptorCollection.Item (Int32)

Gets the event with the specified index number.

[C#] In C#, this member is the indexer for the EventDescriptorCollection class.

[Visual Basic]
Overloads Overridable Public Default ReadOnly Property Item( _
   ByVal index As Integer _
) As EventDescriptor
[C#]
public EventDescriptor this[
   int index
] {virtual get;}
[C++]
public: __property virtual EventDescriptor* get_Item(
   int index
);
[JScript]
returnValue = EventDescriptorCollectionObject.Item(index);
-or-
returnValue = EventDescriptorCollectionObject(index);

[JScript] In JScript, you can use the default indexed properties defined by a type, but you cannot explicitly define your own. However, specifying the expando attribute on a class automatically provides a default indexed Item property whose type is Object and whose index type is String.

Arguments [JScript]

index
The zero-based index number of the EventDescriptor to get from the collection.

Parameters [Visual Basic, C#, C++]

index
The zero-based index number of the EventDescriptor to get from the collection.

Property Value

The EventDescriptor with the specified index number.

Remarks

The index number is zero-based. Therefore, you must subtract one from the numerical position of a particular EventDescriptor to access that EventDescriptor. For example, to get the third EventDescriptor, you need to specify Item property (EventDescriptorCollection indexer)(2).

Example [Visual Basic]

The following example uses the Item property (EventDescriptorCollection indexer) to print the name of the EventDescriptor specified by the index number in a text box. Since the index number is zero-based, this example prints the name of the second EventDescriptor. It assumes Button1 has been instantiated on a form.

[Visual Basic]

Private Sub PrintIndexItem()
   Dim events As EventDescriptorCollection
   events = TypeDescriptor.GetEvents(Button1)

   ' Print the second event's name.
   TextBox1.Text = events.Item(1).Name
End Sub

See Also

EventDescriptorCollection Class | EventDescriptorCollection Members | System.ComponentModel Namespace | EventDescriptorCollection.Item Overload List | EventDescriptor | TypeDescriptor