Control Methods


.NET Framework Class Library
Control..::.SelectNextControl Method

Activates the next control.

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

Visual Basic (Declaration)
Public Function SelectNextControl ( _
    ctl As Control, _
    forward As Boolean, _
    tabStopOnly As Boolean, _
    nested As Boolean, _
    wrap As Boolean _
) As Boolean
Visual Basic (Usage)
Dim instance As Control
Dim ctl As Control
Dim forward As Boolean
Dim tabStopOnly As Boolean
Dim nested As Boolean
Dim wrap As Boolean
Dim returnValue As Boolean

returnValue = instance.SelectNextControl(ctl, _
    forward, tabStopOnly, nested, wrap)
C#
public bool SelectNextControl(
    Control ctl,
    bool forward,
    bool tabStopOnly,
    bool nested,
    bool wrap
)
Visual C++
public:
bool SelectNextControl(
    Control^ ctl, 
    bool forward, 
    bool tabStopOnly, 
    bool nested, 
    bool wrap
)
JScript
public function SelectNextControl(
    ctl : Control, 
    forward : boolean, 
    tabStopOnly : boolean, 
    nested : boolean, 
    wrap : boolean
) : boolean

Parameters

ctl
Type: System.Windows.Forms..::.Control
The Control at which to start the search.
forward
Type: System..::.Boolean
true to move forward in the tab order; false to move backward in the tab order.
tabStopOnly
Type: System..::.Boolean
true to ignore the controls with the TabStop property set to false; otherwise, false.
nested
Type: System..::.Boolean
true to include nested (children of child controls) child controls; otherwise, false.
wrap
Type: System..::.Boolean
true to continue searching from the first control in the tab order after the last control has been reached; otherwise, false.

Return Value

Type: System..::.Boolean
true if a control was activated; otherwise, false.
Remarks

The SelectNextControl method activates the next control in the tab order if the control's Selectable style bit is set to true in ControlStyles, 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.

When you change the focus by using the keyboard (TAB, SHIFT+TAB, and so on), by calling the Select or SelectNextControl methods, or by setting the ContainerControl..::.ActiveControl property to the current form, focus events occur in the following order:

  1. Enter

  2. GotFocus

  3. Leave

  4. Validating

  5. Validated

  6. LostFocus

If the CausesValidation property is set to false, the Validating and Validated events are suppressed.

Platforms

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Version Information

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 3.5, 2.0
See Also

Reference

Tags :


Page view tracker