WinForm上有4个GroupBox,每个GroupBox里面有一些CheckBox,如何遍历这些CheckBox?请给出代码!

解决方案 »

  1.   

    遍历每个GroupBox,并且遍历每个GroupBox的Controls。
      

  2.   

    递归算法      Public Shared Sub OperateControl(ByVal parentControl As Control)            Dim subControl As Control            If IsNothing(parentControl) = True Then
                    Return
                End If            If parentControl.Controls.Count = 0 Then
                    Return
                End If            For Each subControl In parentControl.Controls                If IsNothing(parentControl) = False Then
                        OperateControl(subControl)                End If
                Next            [Your Operations ......]        End Sub
      

  3.   

    选遍历groupcox,再遍历每个checkbox.
      

  4.   

    foreach(groupbox in winform)
    {
        foreach(checkbox in group)
        {
             wrietline();
        }
    }这里只是思路.