Hey everybody. I am fairly new at VB 2010 and I am running into a bit of an issue that has caused me to come to a screeching halt on my current project...

I have been able to generate controls at runtime and obtain values from them without trouble until I generated a Groupbox at runtime and filled it with Checkboxes (obviously at runtime). How can I get the values of each of the runtime generated Checkboxes from each of the runtime generated Groupboxes?

Any help would be appreciated. Here is the code that I used to generate the controls at runtime. I am not quite sure how to go about retrieving the values. Typically I use:


Me.Controls.Item(control name).Text (For my text box controls)

But I am not sure how to get the values of a checkbox control if it is inside of another runtime generated groupbox control.



Sorry that my code shows how much of a beginner that I really am....

Code:
 Private Sub btnAddGroup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddGroup.Click
        Dim strIBResult As String
        Dim intCurrentXPosition As Integer = 25
        Dim intCurrentYPosition As Integer = 120
        Dim intCurrentCBYPosition As Integer = 15
        'Dim intCurrentLabelXPosition As Integer = intCurrentXPosition + 50
        Dim intGroupBoxWidth As Integer = 200
        Dim intGroupBoxHeight As Integer = 200
        Dim intCurrentRow As Integer = 0
        Dim intTotalRows As Integer = m_DataTableClass.Rows.Count

        strIBResult = InputBox("How many groups would you like to add?", "Add Groups", " ")
        If Not IsNumeric(strIBResult) Then
            MessageBox.Show("Add group entry invalid", "Attention")
            Exit Sub
        End If

        intAddGroups = CInt(strIBResult)
        intTotalGroups += intAddGroups

        Do While intCurrentGroup <= intTotalGroups
            Dim grpNewGroupBox = New GroupBox
            grpNewGroupBox.Name = "grpGroup" & intCurrentGroup
            grpNewGroupBox.Text = "Group " & intCurrentGroup
            grpNewGroupBox.Location = New Point(intCurrentXPosition, intCurrentYPosition)
            grpNewGroupBox.Size = New Size(intGroupBoxWidth, intGroupBoxHeight)
            grpNewGroupBox.AutoSize = True

            Do While intCurrentRow < intTotalRows
                Dim chkClassCheckBox = New CheckBox
                chkClassCheckBox.Name = "chkClass" & intCurrentGroup & intCurrentRow
                chkClassCheckBox.Text = m_DataTableClass.Rows(intCurrentRow).Item("ClassName")
                chkClassCheckBox.Location = New Point(intCurrentXPosition, intCurrentCBYPosition)
                grpNewGroupBox.Controls.Add(chkClassCheckBox)

                intCurrentCBYPosition += 30
                intCurrentRow += 1
            Loop

            Me.Controls.Add(grpNewGroupBox)
            intCurrentRow = 0
            intCurrentGroup += 1
            intCurrentYPosition = intCurrentCBYPosition + intCurrentYPosition + 50
            intCurrentCBYPosition = 15
        Loop

        intCurrentGroup = intTotalGroups - 1
        intLastGroupBoxYPosition = intCurrentYPosition
    End Sub
Thanks!