AutomationElementCollection.Item[Int32] Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the AutomationElement at the specified index.
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
Parameters
- index
- Int32
The zero-based index of the element in the collection.
Property Value
The AutomationElement at the specified index.
Exceptions
A negative integer was specified for index
, or index
is greater than or equal to Count.
Examples
In the following example, the first element is retrieved from an 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
Applies to
Samarbeta med oss på GitHub
Källan för det här innehållet finns på GitHub, där du även kan skapa och granska ärenden och pull-begäranden. Se vår deltagarguide för mer information.