title: Get the checked value of radio buttons in a panel within a group box
body: <p>We're doing a project at school and in my program we have two radio buttons(yes/no) that's within a panel and those panels are within a groupbox. How can I get the values from the different radio buttons then? I'm just looking at getting a True/False value. It's like a simplified list of several health issues a user should be able to say if they have or haven't and this will be sent to a database.</p>
  
  <p>I tried to loop through every checkbox and appending each result to a String and then returning that String, but it returns absolutely nothing. There isn't even an error message! I have a suspicion that it might have to do with the fact that I loop through both radiobuttons in the form and checking the if-statement on both, but I don't know how to do that otherwise. Every panel will contain exactly two radio-buttons and nothing more, is it possible to find them by index?</p>
  
  <p>The layout is a little like this</p>
  
  <pre><code>+----------------+
  |   Y N          |
  |+-----+         |
  ||  o o|         |
  ||Panel|         |
  |+-----+         |
  |Groupbox        |  
  +----------------+
  </code></pre>
  
  <p>Where the two o's represents the checkboxes (the Y/N represents Yes/No).</p>
  
  <p>This is the <a href="https://gist.github.com/wOstensen/552c42f8ed18194387cf1b6599d3c6dd" rel="nofollow noreferrer">code</a> I use to loop through everything:</p>
  
  <pre><code>Imports MySql.Data.MySqlClient
  
  Public Class Egenerklaring
      ' The list of booleans that is supposed to be formatted correctly and sent to the database 
      Private verdier As List(Of Boolean) = New List(Of Boolean)
      ' A counter of how many checkboxes which is not checked at all 
      Private ikkeUtfylt As Integer
  
      Private Function skrivUtListe()
          Dim temp As List(Of String) = New List(Of String)
          For Each a As Boolean In verdier
              temp.Add(a.ToString)
          Next
          Return String.Join(",", temp)
      End Function
  
      Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
          Dim i As Integer = 0
          For Each a As Control In Me.Controls
              If TypeOf a Is GroupBox Then
                  For Each b As Control In a.Controls
                      If TypeOf b Is Panel Then
                          For Each c As Control In b.Controls
                              If TypeOf c Is CheckBox Then
                                  ' If checkbox name contains ja / yes 
                                  If c.Name.Contains("ja") AndAlso DirectCast(c, CheckBox).Checked Then
                                      verdier(i) = True
                                      ' If checkbox name contains nei / no 
                                  ElseIf c.Name.Contains("nei") AndAlso DirectCast(c, CheckBox).Checked Then
                                      verdier(i) = False
                                  Else
                                      ikkeUtfylt += 1
                                  End If
                              End If
                              i += 1
                          Next
                      End If
                  Next
              End If
          Next
  
          If ikkeUtfylt &gt; 0 Then
              MsgBox("Fyll ut alle boksene!")
          Else
              MsgBox(Me.skrivUtListe())
          End If
  
      End Sub
  
  End Class   
  </code></pre>
  
  <p>I really am stuck, and would appreciate any help at all.</p>