Control.SelectNextControl(Control, Boolean, Boolean, Boolean, Boolean) 方法   
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
激活下一个控件。
public:
 bool SelectNextControl(System::Windows::Forms::Control ^ ctl, bool forward, bool tabStopOnly, bool nested, bool wrap);public bool SelectNextControl(System.Windows.Forms.Control ctl, bool forward, bool tabStopOnly, bool nested, bool wrap);public bool SelectNextControl(System.Windows.Forms.Control? ctl, bool forward, bool tabStopOnly, bool nested, bool wrap);member this.SelectNextControl : System.Windows.Forms.Control * bool * bool * bool * bool -> boolPublic Function SelectNextControl (ctl As Control, forward As Boolean, tabStopOnly As Boolean, nested As Boolean, wrap As Boolean) As Boolean参数
- forward
- Boolean
如果为 true 则在 Tab 键顺序中前移;如果为 false 则在 Tab 键顺序中后移。
- nested
- Boolean
              true 表示包括嵌套子控件(子控件的子级);false 表示不包括。
- wrap
- Boolean
              true 表示在到达最后一个控件之后从 Tab 键顺序中第一个控件开始继续搜索;false 表示不继续搜索。
返回
如果控件已激活,则为 true;否则为 false。
示例
下面的代码示例演示 SelectNextControl 在具有一些控件的窗体中使用的 方法。 每次单击窗体时,都会激活下一个控件。 属性 ActiveControl 获取容器控件中的当前活动控件。
private void Form1_Click(object sender, EventArgs e)
{
    Control ctl;
    ctl = (Control)sender;
    ctl.SelectNextControl(ActiveControl, true, true, true, true);
}
Private Sub Form1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Click
    Dim ctl As Control
    ctl = CType(sender, Control)
    ctl.SelectNextControl(ActiveControl, True, True, True, True)
End Sub
下面的代码示例演示 SelectNextControl 在具有 Button 和一些其他控件的窗体中使用的 方法。 单击 时, Button激活 后的 Button 下一个控件。 请注意,必须获取控件的父级 Button 。 由于 Button 不是容器,因此直接在 上Button调用 SelectNextControl 不会更改激活。
private void button1_Click(object sender, EventArgs e)
{
    Control p;
    p = ((Button) sender).Parent;
    p.SelectNextControl(ActiveControl, true, true, true, true);
}
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
    Dim p As Control
    p = CType(sender, Button).Parent
    p.SelectNextControl(ActiveControl, True, True, True, True)
End Sub
注解
              SelectNextControl如果控件的Selectable样式位在 中ControlStyles设置为 true ,则该方法按 Tab 键顺序激活下一个控件,该控件包含在另一个控件中,并且其所有父控件都可见且已启用。
以下列表中的Windows 窗体控件不可选择。 从列表中的控件派生的控件也不可选择。
- LinkLabel 当控件) 中不存在链接时 ( 
通过使用键盘 (TAB、SHIFT+TAB 等) 、调用 Select 或 SelectNextControl 方法或将 属性设置为 ContainerControl.ActiveControl 当前窗体来更改焦点时,焦点事件按以下顺序发生:
如果 属性 CausesValidation 设置为 false, Validating 则取消和 Validated 事件。