Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

ComponentCollection.Item Property (String)

Gets any component in the collection matching the specified name.

Namespace:  System.ComponentModel
Assembly:  System (in System.dll)

public virtual IComponent this[
	string name
] { get; }

Parameters

name
Type: System.String

The name of the IComponent to get.

Property Value

Type: System.ComponentModel.IComponent
A component with a name matching the name specified by the name parameter, or null if the named component cannot be found in the collection.

This method can be overridden by a derived class.

This property returns an IComponent in the collection if its Site property is not null and the Name property of its Site property matches the specified string.

NoteNote

This string indexer works only when the component is sited, which typically occurs only at design time. To site a Component at run time, set the Site property of the Component. The Name property of the ISite set to the Site property must also be set for this property to return the component.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft