You can use a Dictionary with the key as the GroupBox name and the value as a List(Of CheckBox). Before adding a GroupBox (as shown below) check to see if the name exists in the Dictionary, if not add or of course remove it and add. Although everything is hard coded in regards to the properties being set that can be dynamic. What the important thing is the code shows the concept.
Code:
Private Sub Button1_Click( _
ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim GroupBoxNames As String() = {"GB1", "GB2", "GB3", "GB1"}
Dim Dict As New Dictionary(Of String, List(Of CheckBox))
For Each item In GroupBoxNames
If Not Dict.ContainsKey(item) Then
Dim GroupBox As New GroupBox With {.Name = item}
Dim Items As New List(Of CheckBox)(New CheckBox() _
{ _
New CheckBox With {.Name = "C1", .Checked = True}, _
New CheckBox With {.Name = "C2", .Checked = False} _
} _
)
Dict.Add(item, Items)
End If
Next
For Each item In Dict
Console.WriteLine("{0} - {1}", item.Key, item.Value.Count)
For Each cb In item.Value
If cb.Checked Then
' do something
Else
' do something else
End If
Next
Next
Dict.Item("GB1").Item(0).Checked = False
Dict.Item("GB1").Item(1).Checked = True
' Who is checked
Dim Result = (From T In Dict.Item("GB1") Where T.Checked = True Select T.Name).ToList
For Each item In Result
Console.WriteLine(item)
Next
End Sub