Form.ControlCollection.Add Method (Control)

 

Adds a control to the form.

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

override Add : 
        value:Control -> unit

Parameters

value
Type: System.Windows.Forms.Control

The Control to add to the form.

Exception Condition
Exception

A multiple document interface (MDI) parent form cannot have controls added to it.

You can use this method to add controls to the form. If you want to add a group of already created controls to the form, use the Control.ControlCollection.AddRange method of the Control.ControlCollection class.

The following code example adds a TextBox and Label control to the control collection of a form. The example requires that a form has been created and named Form1.

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

.NET Framework
Available since 1.1
Return to top
Show: