thanks, ill check it out.

Quote Originally Posted by dbasnett View Post
Something to think about...

Code:
Public Class Form1

    Dim ctlDict As New Dictionary(Of String, Control)

    Private Sub Form1_Load(ByVal sender As System.Object, _
                           ByVal e As System.EventArgs) Handles MyBase.Load

        'build a dictionary of all controls
        Dim ctl As Control = Me.GetNextControl(Me, True) 'Get the first control in the tab order.
        Do Until ctl Is Nothing
            ctlDict.Add(ctl.Name, ctl)
            ctl = Me.GetNextControl(ctl, True) 'Get the next control in the tab order.
        Loop
    End Sub


    Private Sub Button1_Click(ByVal sender As System.Object, _
                              ByVal e As System.EventArgs) Handles Button1.Click
        'query the dictionary of controls
        Dim foo As IEnumerable(Of Generic.KeyValuePair(Of String, Control))
        foo = From de In ctlDict _
              Where de.Key.Contains("Exclude") AndAlso _
              TypeOf de.Value Is CheckBox AndAlso _
              CType(de.Value, CheckBox).Checked Select de

        'the count
        Debug.WriteLine(foo.Count.ToString)
    End Sub
End Class