Langue

AutomationElementCollection.Item[Int32] Propriété

Définition

Obtient l’index AutomationElement spécifié.

public:
 property System::Windows::Automation::AutomationElement ^ default[int] { System::Windows::Automation::AutomationElement ^ get(int index); };
public System.Windows.Automation.AutomationElement this[int index] { get; }
member this.Item(int) : System.Windows.Automation.AutomationElement
Default Public ReadOnly Property Item(index As Integer) As AutomationElement

Paramètres

index
Int32

Index de base zéro de l’élément dans la collection.

Valeur de propriété

À AutomationElement l’index spécifié.

Exceptions

Un entier négatif a été spécifié pour index, ou index est supérieur ou égal à Count.

Exemples

Dans l’exemple suivant, le premier élément est récupéré à partir d’un AutomationElementCollection.

// desktopChildren is a collection of AutomationElement objects.
AutomationElement firstWindow;
try
{
    firstWindow = desktopChildren[0];
}
catch (IndexOutOfRangeException)
{
    Console.WriteLine("No AutomationElement at that index.");
}
' desktopChildren is a collection of AutomationElement objects.
Dim firstWindow As AutomationElement
Try
    firstWindow = desktopChildren(0)
Catch ex As IndexOutOfRangeException
    Console.WriteLine("No AutomationElement at that index.")
End Try

S’applique à