Control.Select Method

Definition

Activates a control.

Overloads

Select()

Activates the control.

Select(Boolean, Boolean)

Activates a child control. Optionally specifies the direction in the tab order to select the control from.

Remarks

The Select method activates the control if the control's ControlStyles.Selectable style bit is set to true, it is contained in another control, and all its parent controls are both visible and enabled.

The Windows Forms controls in the following list are not selectable. Controls derived from controls in the list will also not be selectable.

Select()

Source:
Control.cs
Source:
Control.cs
Source:
Control.cs

Activates the control.

public:
 void Select();
public void Select ();
member this.Select : unit -> unit
Public Sub Select ()

Examples

The following code example selects the specified Control, if it is selectable.

public:
   void ControlSelect( Control^ control )
   {
      
      // Select the control, if it can be selected.
      if ( control->CanSelect )
      {
         control->Select(  );
      }
   }
public void ControlSelect(Control control)
{
   // Select the control, if it can be selected.
   if(control.CanSelect)
   {
      control.Select();
   }
}
Public Sub ControlSelect(control As Control)
   ' Select the control, if it can be selected.
   If control.CanSelect Then
      control.Select()
   End If
End Sub

See also

Applies to

Select(Boolean, Boolean)

Source:
Control.cs
Source:
Control.cs
Source:
Control.cs

Activates a child control. Optionally specifies the direction in the tab order to select the control from.

protected:
 virtual void Select(bool directed, bool forward);
protected virtual void Select (bool directed, bool forward);
abstract member Select : bool * bool -> unit
override this.Select : bool * bool -> unit
Protected Overridable Sub Select (directed As Boolean, forward As Boolean)

Parameters

directed
Boolean

true to specify the direction of the control to select; otherwise, false.

forward
Boolean

true to move forward in the tab order; false to move backward in the tab order.

Remarks

The directed and forward parameters are used by container-style controls. When the directed parameter is set to true, the forward parameter is evaluated to determine which control to select. When forward is set to true, the next control in the tab order is selected; when false, the previous control in the tab order is selected.

See also

Applies to