Export (0) Print
Expand All

Control.ControlCollection.AddRange Method

Adds an array of control objects to the collection.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

abstract AddRange : 
        controls:Control[] -> unit  
override AddRange : 
        controls:Control[] -> unit

Parameters

controls
Type: System.Windows.Forms.Control[]

An array of Control objects to add to the collection.

The Control objects contained in the controls array are appended to the end of the collection.

You can use the AddRange method to quickly add a group of Control objects to the collection instead of manually adding each Control to the collection using the Add method.

To remove a Control that you previously added, use the Remove, RemoveAt, or Clear methods.

Notes to Inheritors

When overriding AddRange in a derived class, be sure to call the base class's AddRange method to ensure that the controls are added to the collection.

The following code example adds two Control objects to the Control.ControlCollection of the derived class Panel. The example requires that you have created a Panel control and a Button control on a Form. When the button is clicked, two RadioButton controls are added to the panel's Control.ControlCollection.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft